pub enum ProviderErrorKind {
Show 21 variants
AuthMissing {
var_hint: Option<String>,
},
AuthMalformed {
hint: Option<String>,
},
AuthRejected {
hint: Option<String>,
},
AuthExpired,
RateLimit {
retry_after: Option<Duration>,
scope: RateLimitScope,
},
QuotaExceeded {
hint: Option<String>,
},
ContextOverflow {
used: Option<u64>,
limit: Option<u64>,
},
MaxTokensInvalid {
requested: Option<u64>,
limit: Option<u64>,
},
ModelNotFound {
model: String,
},
BadRequest {
hint: Option<String>,
},
InvalidToolSchema {
tool: String,
hint: Option<String>,
},
InputBlocked {
policy: Option<String>,
},
OutputBlocked {
policy: Option<String>,
},
ServerError {
status: Option<u16>,
hint: Option<String>,
},
ServerStreamAborted {
hint: Option<String>,
},
Malformed(BoxError),
ProtocolViolation {
hint: String,
},
Transport(BoxError),
Timeout {
phase: TimeoutPhase,
},
Canceled,
Other(BoxError),
}Expand description
Semantic classification of provider errors.
Fallback principle: if a category of errors repeatedly falls into
ProviderErrorKind::Other,
prefer to extract it as a new variant rather than letting Other become the
default.
Variants§
AuthMissing
Missing credential.
AuthMalformed
Malformed credential.
AuthRejected
Credential rejected by the server (401).
AuthExpired
OAuth/STS token expired.
RateLimit
Request-level rate limiting.
QuotaExceeded
Quota exhausted / monthly allowance depleted.
ContextOverflow
Context window overflow.
MaxTokensInvalid
The requested max_tokens exceeds the model’s limit or was rejected by the
server.
ModelNotFound
Model ID does not exist or is unavailable.
BadRequest
Request body rejected by the wire service validation (schema error, conflicting mutually exclusive fields).
InvalidToolSchema
The tool schema referenced in the request was rejected by the server.
InputBlocked
Input triggered a safety filter.
OutputBlocked
Model output blocked by safety filter.
ServerError
A 5xx or server-reported internal error.
ServerStreamAborted
The server aborted the stream during generation.
Malformed(BoxError)
Failed to parse wire JSON / SSE.
ProtocolViolation
The server responded with a wire type or field not defined in the protocol specification.
Transport(BoxError)
Transport-layer error (DNS, TCP, TLS, HTTP).
Timeout
Request timed out.
Fields
phase: TimeoutPhaseCanceled
Canceled by the user or upper layer.
Other(BoxError)
Catch-all variant; prefer to extract cases from here when adding new categories.
Trait Implementations§
Source§impl Debug for ProviderErrorKind
impl Debug for ProviderErrorKind
Source§impl Display for ProviderErrorKind
impl Display for ProviderErrorKind
Source§impl Error for ProviderErrorKind
impl Error for ProviderErrorKind
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()