pub enum TokenError {
RefreshFailed(String),
ObtainFailed {
attempts: u32,
last_error: String,
},
RateLimited {
retry_after_seconds: u64,
},
Timeout {
timeout_seconds: u64,
},
Serialization(String),
Storage(String),
Validation(String),
}Expand description
Detailed error types for token management operations
Variants§
RefreshFailed(String)
ObtainFailed
RateLimited
Timeout
Serialization(String)
Storage(String)
Validation(String)
Implementations§
Source§impl TokenError
impl TokenError
Sourcepub fn refresh_failed<S: Into<String>>(message: S) -> Self
pub fn refresh_failed<S: Into<String>>(message: S) -> Self
Creates a new RefreshFailed error
Sourcepub const fn obtain_failed(attempts: u32, last_error: String) -> Self
pub const fn obtain_failed(attempts: u32, last_error: String) -> Self
Creates a new ObtainFailed error
Sourcepub const fn rate_limited(retry_after_seconds: u64) -> Self
pub const fn rate_limited(retry_after_seconds: u64) -> Self
Creates a new RateLimited error
Sourcepub fn serialization<S: Into<String>>(message: S) -> Self
pub fn serialization<S: Into<String>>(message: S) -> Self
Creates a new Serialization error
Sourcepub fn validation<S: Into<String>>(message: S) -> Self
pub fn validation<S: Into<String>>(message: S) -> Self
Creates a new Validation error
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Returns true if this error indicates a retryable condition
Sourcepub const fn is_rate_limited(&self) -> bool
pub const fn is_rate_limited(&self) -> bool
Returns true if this error indicates a rate limiting condition
Sourcepub const fn retry_after_seconds(&self) -> Option<u64>
pub const fn retry_after_seconds(&self) -> Option<u64>
Returns the retry delay in seconds if this is a rate limited error
Trait Implementations§
Source§impl Clone for TokenError
impl Clone for TokenError
Source§fn clone(&self) -> TokenError
fn clone(&self) -> TokenError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenError
impl Debug for TokenError
Source§impl Display for TokenError
impl Display for TokenError
impl Eq for TokenError
Source§impl Error for TokenError
impl Error for TokenError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Error> for TokenError
impl From<Error> for TokenError
Source§impl From<TokenError> for Error
impl From<TokenError> for Error
Source§fn from(source: TokenError) -> Self
fn from(source: TokenError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TokenError
impl PartialEq for TokenError
impl StructuralPartialEq for TokenError
Auto Trait Implementations§
impl Freeze for TokenError
impl RefUnwindSafe for TokenError
impl Send for TokenError
impl Sync for TokenError
impl Unpin for TokenError
impl UnsafeUnpin for TokenError
impl UnwindSafe for TokenError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.