Skip to main content

ErrorKind

Enum ErrorKind 

Source
#[non_exhaustive]
pub enum ErrorKind { InvalidGrant, ReauthRequired, Transport { retryable: bool, }, Protocol, Auth, DPoP, Config, Crypto, RequestRejected, Backoff, }
Expand description

Classification of an Error.

Marked #[non_exhaustive]: match with a wildcard arm. Variants are kept coarse deliberately — additions are non-breaking, removals are not.

Most application code does not need to match individual variants: the three signals described in the error model (retry / re-authenticate / fail) are the intended consumption pattern.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidGrant

RFC 6749 §5.2 invalid_grant — the grant itself is dead.

Seen when driving a grant directly. A token cache absorbs this kind: it discards the rejected refresh token and reports ReauthRequired once no token source remains.

§

ReauthRequired

No token can be obtained without re-running the interactive flow: the refresh token is missing or was definitively rejected, and no usable grant parameters remain.

Transient failures are deliberately not classified as this kind — they keep their retryable classification (see Error::is_retryable), since a later call may succeed without user involvement.

§

Transport

Transport-level failure.

Fields

§retryable: bool

If true, re-sending the request is known to be safe and may succeed: either the request never reached the server, or it was declared Idempotency::Idempotent and the failure was transient. Requests of unknown idempotency are only retryable when they provably never reached the server.

§

Protocol

Malformed or invalid server response.

§

Auth

Client authentication could not be constructed.

§

DPoP

DPoP proof construction or handling failed.

§

Config

Builder, URL, or other setup error.

§

Crypto

Cryptographic operation failed.

§

RequestRejected

The request was rejected for its parameters, but the credential is intact (RFC 6749 §5.2 invalid_scope, RFC 8707 invalid_target).

Recoverable by adjusting the request — narrowing the requested scope, fixing the resource indicator — and retrying with the same credential. Re-authentication does not help, and a token cache deliberately does not discard the parameter source for this kind.

§

Backoff

No token can be obtained right now, but the source expects the condition to clear on its own: it is backing off after repeated non-recoverable failures from scratch (for example an assertion signer that keeps producing values the server rejects with invalid_grant).

Distinct from its neighbours. Unlike ReauthRequired it does not call for re-running the interactive flow: a later automatic call, after the source’s cooldown, may succeed once the underlying cause is fixed (a rotated signing key, a corrected clock). Unlike a retryable Transport failure, retrying immediately will not help — wait for the cooldown before re-attempting. In short: try again later, without user involvement.

Trait Implementations§

Source§

impl Clone for ErrorKind

Source§

fn clone(&self) -> ErrorKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ErrorKind

Source§

impl Debug for ErrorKind

Source§

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

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

impl Display for ErrorKind

Source§

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

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

impl Eq for ErrorKind

Source§

impl From<ErrorKind> for Error

Source§

fn from(kind: ErrorKind) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ErrorKind

Source§

fn eq(&self, other: &ErrorKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorKind

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.