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.
Only upstream server errors (5xx) are fallback-eligible. A
deterministic client error (400 invalid request, 403 forbidden, 422
unprocessable) will fail identically on every provider, so failing
over just burns extra upstream calls + spend. Matches the >= 500
guard in Self::is_retriable. (429 maps to Self::RateLimited
and timeouts to Self::Timeout, which are handled separately.)
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for ProviderError
impl !UnwindSafe for ProviderError
impl Freeze for ProviderError
impl Send for ProviderError
impl Sync for ProviderError
impl Unpin for ProviderError
impl UnsafeUnpin for ProviderError
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
Mutably borrows from an owned value. Read more