#[non_exhaustive]pub enum OauthError {
AccessDenied(OauthErrorResponse),
ExpiredToken(OauthErrorResponse),
Rejected(OauthErrorResponse),
Client(Error),
}Expand description
What every OauthApi call fails with.
Separate from Error because adding variants to that enum would break
every caller matching it exhaustively. An ordinary failure - a transport
error, a timeout, a 5xx, a 4xx that is not an OAuth refusal - is
OauthError::Client, exactly the Error any other call would give.
The OAuth refusals are never retryable.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AccessDenied(OauthErrorResponse)
The person refused the sign-in (access_denied).
ExpiredToken(OauthErrorResponse)
The device code expired, or was already exchanged or refused
(expired_token). A poll that outlived the code locally carries no
status.
Rejected(OauthErrorResponse)
Any other OAuth refusal, including a code this version has never seen:
authorization_pending, slow_down, invalid_grant, invalid_client.
Client(Error)
Anything that is not an OAuth refusal.
Implementations§
Source§impl OauthError
impl OauthError
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Follows the status like any response’s: 400 is a bad request and 401 an unregistered client ID, never the API key, which these requests do not carry. The expiry a poll decides locally is a bad request.
pub fn retryable(&self) -> bool
pub fn status(&self) -> Option<u16>
Sourcepub fn error_code(&self) -> Option<&str>
pub fn error_code(&self) -> Option<&str>
The OAuth error, or None for an ordinary failure.
pub fn error_description(&self) -> Option<&str>
Trait Implementations§
Source§impl Debug for OauthError
impl Debug for OauthError
Source§impl Display for OauthError
impl Display for OauthError
Source§impl Error for OauthError
impl Error for OauthError
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()