pub enum ProviderError {
Unauthorized(String),
RateLimited {
retry_after_ms: u64,
},
ModelNotFound {
model: String,
},
InvalidRequest(String),
ProviderUpstream {
status: u16,
message: String,
},
Timeout {
ms: u64,
},
Network(Error),
Deserialize(String),
Unsupported(String),
Internal(String),
}Variants§
RateLimited
ModelNotFound
InvalidRequest(String)
ProviderUpstream
Timeout
Network(Error)
Deserialize(String)
Unsupported(String)
Internal(String)
Implementations§
Source§impl ProviderError
impl ProviderError
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
True if the error is retriable. The core layer applies backoff + jitter.
Sourcepub fn is_fallback_eligible(&self) -> bool
pub fn is_fallback_eligible(&self) -> bool
True if the error means we should try a fallback provider.
Transient/load and server-side conditions are fallback-eligible:
upstream server errors (5xx), timeouts, model-not-found, and rate
limiting (429). A 429 is also Self::is_retriable, so the dispatch
loop first exhausts the same-provider retry budget (honoring
retry_after_ms); only then does failover advance to a candidate that
may have spare quota — a common real-world recovery during a primary
provider’s capacity crunch.
A deterministic client error (400 invalid request, 403 forbidden, 422 unprocessable) is NOT eligible: it would fail identically on every provider, so failing over just burns extra upstream calls + spend.
Trait Implementations§
Source§impl Debug for ProviderError
impl Debug for ProviderError
Source§impl Display for ProviderError
impl Display for ProviderError
Source§impl Error for ProviderError
impl Error for ProviderError
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()