pub enum AuthError {
Show 19 variants
Transport(Error),
UpgradeRequired(Box<UpgradeRequired>),
InvalidBaseUrl {
url: String,
reason: String,
},
InvalidCredentials,
AccountLocked,
RateLimited {
retry_after_secs: u64,
code: Option<String>,
},
SessionExpired,
NotAuthenticated,
SecondFactorRequired,
OidcNotConfigured,
OidcRedirectInvalid,
OidcRejected {
code: Option<String>,
},
OidcAddressTaken,
OidcDeviceUnsupported,
OidcDeviceDenied,
OidcDeviceExpired,
Network {
endpoint: &'static str,
detail: String,
},
Unexpected {
status: u16,
endpoint: &'static str,
detail: String,
code: Option<String>,
},
MalformedResponse {
endpoint: &'static str,
reason: String,
},
}Expand description
Everything the auth flows can fail with. Callers switch on the typed variant
(never a bare HTTP status); AuthError::error_code yields the stable
error.* catalog code for client localization where one applies.
Variants§
Transport(Error)
Transport-level failure (DNS, TLS, connection, timeout).
UpgradeRequired(Box<UpgradeRequired>)
The server will not take this client’s writes: it answered 426, or the window it
advertised already refuses this build (issue #674). Update the app.
InvalidBaseUrl
The configured base URL could not be parsed.
InvalidCredentials
Login was rejected: the credentials were wrong.
AccountLocked
Login was rejected: the account is temporarily locked.
RateLimited
The server asked the client to back off.
One variant for every 429, because the client’s response is the same: wait
retry_after_secs and try again. code keeps which cause the server named (a spent
budget error.auth.rate_limited, a full limiter error.auth.registration_at_capacity),
so AuthError::error_code renders the server’s own message.
Fields
SessionExpired
The session is gone (refresh token expired or revoked). The user must re-authenticate interactively.
NotAuthenticated
An authenticated operation was attempted with no active session.
SecondFactorRequired
A code is needed and this caller cannot ask for one.
Only produced by LoginOutcome::into_session: the login itself answers a
LoginOutcome, because a second factor is the system working rather than a failure.
OidcNotConfigured
The server has no identity provider (error.auth.oidc_not_configured).
A client that read auth.oidc: null from server-info never sees this; one that offered
the option anyway does.
OidcRedirectInvalid
The redirect URI this client asked for is not one the server admits
(error.auth.oidc_redirect_invalid). A client or deployment misconfiguration.
OidcRejected
The callback was refused: the ceremony expired or was replayed, the provider refused the
exchange, or the ID token failed a check. Every one means “start the sign-in again”, so
they are one variant; code says which for a log line.
OidcAddressTaken
The identity provider asserted an address that already has a local account
(error.auth.oidc_address_taken). Never linked: the person signs in with that account’s
password instead.
OidcDeviceUnsupported
The server’s identity provider does not offer the device authorization grant
(error.auth.oidc_device_unsupported): sign in with the browser flow instead.
OidcDeviceDenied
The person declined the device sign-in at the identity provider
(error.auth.oidc_device_denied).
OidcDeviceExpired
The device sign-in is over: expired, already used, or not this client’s
(error.auth.oidc_device_expired). Start again.
Network
The generated client could not reach the server, or could not build the request.
The generated client classifies its transport failures itself (DNS, connection, TLS,
timeout, redirect policy) and they are not reqwest::Errors, so they cannot ride
AuthError::Transport; the class and the endpoint are what a caller acts on.
Fields
Unexpected
A server response the client does not model.
Fields
MalformedResponse
A success response whose body did not match the token contract.
Implementations§
Source§impl AuthError
impl AuthError
Sourcepub fn error_code(&self) -> Option<&str>
pub fn error_code(&self) -> Option<&str>
The stable error.* catalog code a client localizes, when one applies.
The English Display form is the developer/log detail;
clients render a localized high-level message from this code (mirrors the
server’s ApiError { error, code } contract).
Trait Implementations§
Source§impl Error for AuthError
impl Error for AuthError
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()
Source§impl From<AuthError> for AlbumError
impl From<AuthError> for AlbumError
Source§impl From<AuthError> for LifecycleOpError
impl From<AuthError> for LifecycleOpError
Source§impl From<AuthError> for DirectoryError
impl From<AuthError> for DirectoryError
Source§impl From<AuthError> for UpgradeError
impl From<AuthError> for UpgradeError
Source§impl From<AuthError> for UploadError
impl From<AuthError> for UploadError
Source§impl From<AuthError> for VerifyError
impl From<AuthError> for VerifyError
Source§impl From<UpgradeRequired> for AuthError
impl From<UpgradeRequired> for AuthError
Source§fn from(refusal: UpgradeRequired) -> Self
fn from(refusal: UpgradeRequired) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for AuthError
impl !UnwindSafe for AuthError
impl Freeze for AuthError
impl Send for AuthError
impl Sync for AuthError
impl Unpin for AuthError
impl UnsafeUnpin for AuthError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more