#[non_exhaustive]pub enum LlmError {
Show 15 variants
RateLimit {
retry_after: Option<Duration>,
},
QuotaExceeded {
detail: String,
},
ContextLengthExceeded {
max_tokens: u32,
},
AuthFailed {
detail: String,
},
ModelNotFound(String),
ModelUnavailable(String),
ProviderUnavailable(String),
ContentFiltered {
detail: String,
},
Network(String),
Timeout(Duration),
InvalidRequest(String),
UnsupportedCapability(String),
Protocol(String),
StreamInterrupted(String),
Provider(String),
}Expand description
Error taxonomy for LLM component operations.
Provider-agnostic — no provider-specific variants. Use the Provider(String)
catch-all for provider-specific errors; the constructor truncates messages
to 200 bytes with UTF-8 safety.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RateLimit
Rate limited by provider; optionally carries a retry-after duration.
QuotaExceeded
Usage quota exceeded (e.g., billing limit reached).
ContextLengthExceeded
Request exceeds provider context window.
AuthFailed
Authentication / authorization failure.
ModelNotFound(String)
Requested model does not exist.
Model is temporarily unavailable (e.g., overloaded).
Provider endpoint is unreachable or returning server errors.
ContentFiltered
Response was blocked by the provider’s content safety policy.
Network(String)
Transient network error (connection reset, DNS failure, etc.).
Timeout(Duration)
Request exceeded the configured timeout.
InvalidRequest(String)
Request was malformed or violated provider constraints.
UnsupportedCapability(String)
The operation is not supported by this provider.
Protocol(String)
Response could not be decoded or parsed.
StreamInterrupted(String)
Stream was terminated before completion.
Provider(String)
Provider-specific error (catch-all). Message is automatically truncated
to 200 bytes with UTF-8 safety via LlmError::provider.
Implementations§
Trait Implementations§
Source§impl Error for LlmError
impl Error for LlmError
1.30.0 · 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()