pub enum BackendErrorKind {
Timeout,
RateLimit {
retry_after: Option<Duration>,
},
ServerError {
status: u16,
},
AuthError,
NetworkError,
StreamDropped,
InvalidResponse,
ProviderUnavailable,
CircuitOpen,
Unknown,
}Expand description
Classification of backend API errors.
Variants§
Timeout
Request timed out (connect or read timeout).
RateLimit
Provider returned 429 Too Many Requests.
ServerError
Provider returned a server error (5xx).
AuthError
Authentication failed (401/403) — API key invalid or expired.
NetworkError
Network-level error (DNS, connection refused, TLS, etc.).
StreamDropped
SSE stream dropped mid-response.
InvalidResponse
Provider response could not be parsed.
Provider is unknown or not registered.
CircuitOpen
Circuit breaker is open — calls are being rejected.
Unknown
Unclassified error.
Implementations§
Source§impl BackendErrorKind
impl BackendErrorKind
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether this error type is worth retrying.
Sourcepub fn from_status(status: u16) -> Self
pub fn from_status(status: u16) -> Self
Classify an HTTP status code into an error kind.
Sourcepub fn from_reqwest_error(e: &Error) -> Self
pub fn from_reqwest_error(e: &Error) -> Self
Classify a reqwest error into an error kind.
Trait Implementations§
Source§impl Clone for BackendErrorKind
impl Clone for BackendErrorKind
Source§fn clone(&self) -> BackendErrorKind
fn clone(&self) -> BackendErrorKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackendErrorKind
impl Debug for BackendErrorKind
Auto Trait Implementations§
impl Freeze for BackendErrorKind
impl RefUnwindSafe for BackendErrorKind
impl Send for BackendErrorKind
impl Sync for BackendErrorKind
impl Unpin for BackendErrorKind
impl UnsafeUnpin for BackendErrorKind
impl UnwindSafe for BackendErrorKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.