#[non_exhaustive]pub enum RouterError {
Empty,
AllFailed {
tried: usize,
last: Box<dyn Error + Send + Sync>,
},
Model {
model: String,
source: Box<dyn Error + Send + Sync>,
},
RateLimited {
model: String,
reason: RateLimitReason,
},
BudgetExceeded(BudgetExceeded),
}Expand description
Unified error for RouterLLM.
Aggregates heterogeneous provider errors behind Box<dyn Error> so a
single router can mix providers whose native error types differ.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
No models were configured on the router.
AllFailed
Every candidate model was tried and all failed.
tried is the number of models attempted; last is the final error.
Fields
Model
A single model failed (wrapped when propagating from an adapter).
Fields
RateLimited
The slot’s per-model rate limiter could not admit the call in time. The router treats this like a model failure and tries the next slot.
Fields
reason: RateLimitReasonWhether the queue was full or the wait timed out.
BudgetExceeded(BudgetExceeded)
The router budget would have been exceeded by the projected call. The router skips that slot (free slots remain reachable) and tries the next candidate; this surfaces as the final error only when every candidate was skipped.
Tuple Fields
0: BudgetExceededSnapshot of the exceeded dimension, used amount and limit.
Trait Implementations§
Source§impl Debug for RouterError
impl Debug for RouterError
Source§impl Display for RouterError
impl Display for RouterError
Source§impl Error for RouterError
impl Error for RouterError
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()