#[non_exhaustive]pub enum ErrorCategory {
BusinessLogic,
External,
Internal,
Client,
Transient,
}Expand description
High-level categorization of errors for routing and handling decisions.
Use LlmError::category() to get the category for any error.
§Example
use multi_llm::{LlmError, error::ErrorCategory};
fn should_alert_ops(err: &LlmError) -> bool {
matches!(err.category(), ErrorCategory::Internal | ErrorCategory::External)
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BusinessLogic
Expected business logic outcomes (not typically errors).
These are “errors” that represent normal application flow, like “user not found” when checking if a user exists.
External
External service failures (LLM providers, network issues).
The LLM provider or network had an issue. May be transient or indicate a provider outage.
Internal
Internal system errors (bugs, invariant violations).
Something went wrong in the code itself. These should be logged and investigated.
Client
Client errors (invalid input, authentication, configuration).
The caller made a mistake that they can fix (wrong API key, invalid parameters, etc.).
Transient
Temporary failures that should be retried.
Rate limits, timeouts, and other transient issues. Retry with exponential backoff.
Trait Implementations§
Source§impl Clone for ErrorCategory
impl Clone for ErrorCategory
Source§fn clone(&self) -> ErrorCategory
fn clone(&self) -> ErrorCategory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErrorCategory
impl Debug for ErrorCategory
Source§impl Default for ErrorCategory
impl Default for ErrorCategory
Source§fn default() -> ErrorCategory
fn default() -> ErrorCategory
Source§impl PartialEq for ErrorCategory
impl PartialEq for ErrorCategory
impl Copy for ErrorCategory
impl Eq for ErrorCategory
impl StructuralPartialEq for ErrorCategory
Auto Trait Implementations§
impl Freeze for ErrorCategory
impl RefUnwindSafe for ErrorCategory
impl Send for ErrorCategory
impl Sync for ErrorCategory
impl Unpin for ErrorCategory
impl UnwindSafe for ErrorCategory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.