#[non_exhaustive]pub enum KernelError {
LlmApi(String),
RateLimited(u64),
Http {
status: u16,
message: String,
},
Timeout(u64),
Config(String),
Store(String),
Vault(String),
Io(Error),
Search(String),
Embedding(String),
Discovery(String),
Serialization(Error),
}Expand description
Errors that can occur when using llm-kernel.
#[non_exhaustive]: new variants may be added in any minor release. External
matches must include a _ => arm; prefer matching only the variants you
act on (e.g. KernelError::RateLimited / KernelError::Http for retry).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LlmApi(String)
An LLM API returned an error response.
RateLimited(u64)
The LLM API rate-limited the request.
Http
An HTTP error occurred (non-200 status with code).
Timeout(u64)
A request timed out.
Config(String)
A configuration error (missing field, bad format, etc.).
Store(String)
A store (SQLite) error.
Vault(String)
A secrets vault error.
Io(Error)
An I/O error.
Search(String)
A search backend error.
Embedding(String)
An embedding provider or vector-index error.
Discovery(String)
A model-discovery error.
Serialization(Error)
A serialization/deserialization error.
Available whenever any feature that pulls in serde_json is enabled —
not just provider. Add new serde_json-using features to this any(...)
list so a ?-conversion into KernelError keeps compiling everywhere
serde_json is available.
Implementations§
Source§impl KernelError
impl KernelError
Sourcepub fn embedding(e: impl Display) -> Self
pub fn embedding(e: impl Display) -> Self
Construct an KernelError::Embedding from any displayable error.
Convenience for mapping external errors (HTTP clients, ONNX runtimes) at
? sites: .map_err(KernelError::embedding)?.
Sourcepub fn discovery(e: impl Display) -> Self
pub fn discovery(e: impl Display) -> Self
Construct an KernelError::Discovery from any displayable error.
Trait Implementations§
Source§impl Debug for KernelError
impl Debug for KernelError
Source§impl Display for KernelError
impl Display for KernelError
Source§impl Error for KernelError
impl Error for KernelError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()