Skip to main content

ProviderErrorKind

Enum ProviderErrorKind 

Source
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.

Fields

§var_hint: Option<String>
§

AuthMalformed

Malformed credential.

Fields

§

AuthRejected

Credential rejected by the server (401).

Fields

§

AuthExpired

OAuth/STS token expired.

§

RateLimit

Request-level rate limiting.

Fields

§retry_after: Option<Duration>
§

QuotaExceeded

Quota exhausted / monthly allowance depleted.

Fields

§

ContextOverflow

Context window overflow.

Fields

§used: Option<u64>
§limit: Option<u64>
§

MaxTokensInvalid

The requested max_tokens exceeds the model’s limit or was rejected by the server.

Fields

§requested: Option<u64>
§limit: Option<u64>
§

ModelNotFound

Model ID does not exist or is unavailable.

Fields

§model: String
§

BadRequest

Request body rejected by the wire service validation (schema error, conflicting mutually exclusive fields).

Fields

§

InvalidToolSchema

The tool schema referenced in the request was rejected by the server.

Fields

§tool: String
§

InputBlocked

Input triggered a safety filter.

Fields

§policy: Option<String>
§

OutputBlocked

Model output blocked by safety filter.

Fields

§policy: Option<String>
§

ServerError

A 5xx or server-reported internal error.

Fields

§status: Option<u16>
§

ServerStreamAborted

The server aborted the stream during generation.

Fields

§

Malformed(BoxError)

Failed to parse wire JSON / SSE.

§

ProtocolViolation

The server responded with a wire type or field not defined in the protocol specification.

Fields

§hint: String
§

Transport(BoxError)

Transport-layer error (DNS, TCP, TLS, HTTP).

§

Timeout

Request timed out.

Fields

§

Canceled

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ProviderErrorKind

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ProviderErrorKind

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.