pub struct ProviderErrorContext {
pub grant_type: GrantType,
pub http_status: Option<u16>,
pub oauth_error: Option<String>,
pub error_description: Option<String>,
pub body_preview: Option<String>,
pub network_error: bool,
}Expand description
Context passed to provider strategies when classifying token errors.
The struct intentionally keeps only primitive data (status codes, OAuth fields,
body preview) so strategies stay completely decoupled from any HTTP client
(e.g., reqwest). Builders on the flows side populate the context before
invoking ProviderStrategy::classify_token_error.
Fields§
§grant_type: GrantTypeGrant type associated with the failing request.
http_status: Option<u16>HTTP status code returned by the provider, when available.
oauth_error: Option<String>Provider-supplied OAuth error field.
error_description: Option<String>Provider-supplied OAuth error_description field.
body_preview: Option<String>Preview of the response body for non-JSON payloads.
network_error: boolIndicates whether the failure originated from the network/transport layer.
Implementations§
Source§impl ProviderErrorContext
impl ProviderErrorContext
Sourcepub fn new(grant_type: GrantType) -> Self
pub fn new(grant_type: GrantType) -> Self
Creates a new context scoped to the provided grant type.
Sourcepub fn network_failure(grant_type: GrantType) -> Self
pub fn network_failure(grant_type: GrantType) -> Self
Convenience constructor for transport-level/network failures.
Sourcepub fn with_network_error(self, network_error: bool) -> Self
pub fn with_network_error(self, network_error: bool) -> Self
Overrides the network error flag.
Sourcepub fn with_http_status(self, status: u16) -> Self
pub fn with_http_status(self, status: u16) -> Self
Adds an HTTP status code (e.g., 400, 401, 500).
Sourcepub fn with_oauth_error(self, error: impl Into<String>) -> Self
pub fn with_oauth_error(self, error: impl Into<String>) -> Self
Adds the OAuth error code string returned by the provider.
Sourcepub fn with_error_description(self, description: impl Into<String>) -> Self
pub fn with_error_description(self, description: impl Into<String>) -> Self
Adds the OAuth error_description field.
Sourcepub fn with_body_preview(self, body: impl Into<String>) -> Self
pub fn with_body_preview(self, body: impl Into<String>) -> Self
Adds a body preview for providers that return non-JSON payloads.
Trait Implementations§
Source§impl Clone for ProviderErrorContext
impl Clone for ProviderErrorContext
Source§fn clone(&self) -> ProviderErrorContext
fn clone(&self) -> ProviderErrorContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderErrorContext
impl Debug for ProviderErrorContext
Source§impl PartialEq for ProviderErrorContext
impl PartialEq for ProviderErrorContext
impl Eq for ProviderErrorContext
impl StructuralPartialEq for ProviderErrorContext
Auto Trait Implementations§
impl Freeze for ProviderErrorContext
impl RefUnwindSafe for ProviderErrorContext
impl Send for ProviderErrorContext
impl Sync for ProviderErrorContext
impl Unpin for ProviderErrorContext
impl UnwindSafe for ProviderErrorContext
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
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
key and return true if they are equal.