pub enum ProviderError {
Transport(String),
RateLimited {
retry_after: Option<Duration>,
},
Api {
status: u16,
message: String,
},
ContextOverflow,
Quota,
Auth(String),
Decode(String),
Config(String),
}Expand description
Why a model call failed (ADR-0007).
An exhaustive taxonomy (not #[non_exhaustive]): like Grok’s SamplingError
and Codex’s CodexErr, ProviderError::retryable matches every variant with
no wildcard, so a new error cannot be added without classifying it. Distinct
terminal variants (context overflow, quota, auth) follow Codex; the general
ProviderError::Api is the escape hatch for unclassified HTTP statuses.
Variants§
Transport(String)
A transport/network failure (connection reset, DNS, TLS). Retryable.
RateLimited
Rate limited (HTTP 429). Surfaced, not silently hammered; a bounded retry
honors retry_after when present.
Fields
Api
A general API error carrying the HTTP status; retryable iff 5xx/overloaded.
ContextOverflow
The request exceeded the model’s context window. Terminal.
Quota
The account’s quota/usage limit is exhausted. Terminal.
Auth(String)
Authentication failed (e.g. 401 after a refresh attempt). Terminal here; refresh-and-retry-once is the wire’s job before surfacing this.
Decode(String)
The response could not be parsed into a Completion. Terminal.
Config(String)
The request configuration is invalid for this wire (e.g. an unknown reasoning-effort tier on a fixed-mapping wire). Terminal, pre-send.
Implementations§
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
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()