pub enum ProviderError {
RateLimit {
retry_after: Option<Duration>,
},
Overloaded,
ServerError,
Auth,
Billing,
ContextOverflow,
Invalid(String),
Transport,
}Expand description
Why a provider call failed, coarsely enough to decide policy per class.
Classification is by status and by message text, because the text is
sometimes the only signal — no backend gives context overflow a usable
code, which is the lesson is_context_overflow already encodes.
Variants§
RateLimit
HTTP 429 — Retry-After is honoured when it is sane; a provider can
name a wait long enough that the process is simply asleep.
Overloaded
The provider says it is drowning (529, or a 503 that says so).
ServerError
Any other 5xx.
Auth
401/403 — terminal; the same key fails the same way every time.
Billing
Credit exhausted — terminal, and retrying it spends nothing but time.
ContextOverflow
The prompt does not fit. Never retried here: the compaction path in the loop owns this one, and a retry with the same payload cannot fit any better.
Invalid(String)
Any other 4xx — the same payload fails the same way.
Transport
Connect failures, timeouts, aborted writes. The pooled-connection race lands here.
Implementations§
Trait Implementations§
Source§impl Clone for ProviderError
impl Clone for ProviderError
Source§fn clone(&self) -> ProviderError
fn clone(&self) -> ProviderError
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 ProviderError
impl Debug for ProviderError
Source§impl Display for ProviderError
impl Display for ProviderError
impl Eq for ProviderError
Source§impl Error for ProviderError
impl Error for ProviderError
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()