pub enum DeviceFlowError {
AccessDenied,
Expired,
IncorrectDeviceCode,
AppMisconfigured {
code: String,
},
Unexpected {
code: String,
},
UntrustedVerificationUri {
origin: String,
},
Transport(Error),
Status {
status: u16,
stage: &'static str,
},
Decode {
stage: &'static str,
source: Error,
},
Malformed {
what: &'static str,
value: String,
},
Config(ConfigError),
}Expand description
Every way a login can fail.
GitHub’s error_description is deliberately not carried into any of
these. It is free text from a remote party, and this crate’s redaction gate
is far easier to keep true by construction than by auditing what a remote
string happened to contain. The machine-readable error code is documented
and exhaustive, and it is what a caller branches on anyway.
Variants§
AccessDenied
The user declined. Terminal, and not a failure to retry: retrying re-prompts someone who already said no.
Expired
The device code timed out before approval. A whole new login is needed — the same code cannot be re-presented.
IncorrectDeviceCode
GitHub does not recognise the device code. A new login is needed.
AppMisconfigured
The App registration itself is wrong — device flow not enabled, or a bad
client_id. No amount of retrying helps; a maintainer must fix the
published App (06-migration-rollout.md, Phase 0).
Unexpected
UntrustedVerificationUri
A verification_uri that is not on the configured GitHub web host.
The user’s code must only ever be typed on GitHub’s own domain.
Transport(Error)
Status
Decode
Malformed
Config(ConfigError)
Implementations§
Source§impl DeviceFlowError
impl DeviceFlowError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether presenting the same login again could succeed.
The two recoverable protocol states, authorization_pending and
slow_down, are PollOutcomes and never become errors at all, so this
is not about them. It is about the two failures that say nothing about
the login: a dropped connection and a 5xx from a gateway. The device
code is still live in both cases, and the next poll can still succeed —
which is why DeviceFlow::complete absorbs up to
MAX_TRANSPORT_RETRIES of them rather than destroying a login over a
blip.
Everything else is false, and deliberately so. A caller that retried
DeviceFlowError::AccessDenied would re-prompt a user who has already
refused; one that retried DeviceFlowError::Expired would present a
code GitHub has already discarded. Those are the cases this method exists
to keep false, and no 5xx handling may be allowed to blur them.
Sourcepub fn requires_new_login(&self) -> bool
pub fn requires_new_login(&self) -> bool
Whether the remedy is a fresh auth login rather than a maintainer fix.
Trait Implementations§
Source§impl Debug for DeviceFlowError
impl Debug for DeviceFlowError
Source§impl Display for DeviceFlowError
impl Display for DeviceFlowError
Source§impl Error for DeviceFlowError
impl Error for DeviceFlowError
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()