pub enum BackendError {
RateLimit {
provider: String,
model: String,
retry_after_seconds: Option<u64>,
body_preview: String,
},
Auth {
provider: String,
model: String,
api_key_env: Option<String>,
status: u16,
body_preview: String,
},
ContextLength {
provider: String,
model: String,
body_preview: String,
},
SafetyBreach {
provider: String,
model: String,
finish_reason: String,
body_preview: String,
},
ModelNotFound {
provider: String,
model: String,
status: u16,
body_preview: String,
},
Generic {
provider: String,
model: String,
status: Option<u16>,
message: String,
},
}Expand description
Typed transport error from a native Rust backend.
Each variant carries enough context to render a useful message for the adopter without sacrificing programmatic dispatch — the message body repeats the provider name + model name + status code so log-only consumers don’t lose information.
Variants§
RateLimit
Provider rate limit hit (HTTP 429); retries exhausted or unavailable.
Auth
Provider rejected the request as unauthenticated (HTTP 401 / 403).
ContextLength
Compiled prompt exceeds the model’s context window (HTTP 400 with a
context_length_exceeded / maximum context / too long shape).
SafetyBreach
Provider’s content filter blocked the request or response.
ModelNotFound
Provider does not recognise the requested model identifier.
Generic
Unmapped HTTP error or transport-layer failure.
Implementations§
Source§impl BackendError
impl BackendError
Sourcepub fn model(&self) -> &str
pub fn model(&self) -> &str
Resolved model name reported by the error (always set; may be the provider’s default if the request omitted one).
Sourcepub fn kind(&self) -> BackendErrorKind
pub fn kind(&self) -> BackendErrorKind
Translate into the legacy BackendErrorKind taxonomy so that
existing infra in resilient_backend.rs / circuit_breaker.rs /
retry_policy.rs continues to drive retry / CB decisions without
changes during the Fase 24 transition (D6 — dual presence).
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether the transport layer should retry this error before giving
up. Consults Self::kind + the legacy is_retryable predicate
so the policy stays in lockstep with resilient_backend.
Trait Implementations§
Source§impl Clone for BackendError
impl Clone for BackendError
Source§fn clone(&self) -> BackendError
fn clone(&self) -> BackendError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BackendError
impl Debug for BackendError
Source§impl Display for BackendError
impl Display for BackendError
Source§impl Error for BackendError
impl Error for BackendError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for BackendError
impl RefUnwindSafe for BackendError
impl Send for BackendError
impl Sync for BackendError
impl Unpin for BackendError
impl UnsafeUnpin for BackendError
impl UnwindSafe for BackendError
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<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>
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>
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 more