pub enum Error {
Unauthorized {
url: String,
body: String,
},
Http {
status: u16,
url: String,
body: String,
},
Network(Error),
Decode {
url: String,
source: Error,
},
StateMismatch {
actual: Option<String>,
expected: String,
},
Cancelled(String),
Timeout(Duration),
BadRequest(String),
Io(Error),
}Expand description
All errors surfaced by the crate.
Variants§
The platform returned 401. Split out from Error::Http so
consumers can render a tailored “sign in again” message instead
of the raw response body — the right remedy is almost always
“mint a fresh token”, and the body alone ({"error":"unauthenticated"})
doesn’t tell the user that.
Fields
Http
The platform returned a non-2xx status (other than 401, which has
its own Error::Unauthorized variant). body is truncated to a
reasonable size before being attached.
Network(Error)
Underlying transport failure (DNS, TLS, connection reset, …).
Decode
The response body wasn’t valid JSON for the expected shape.
StateMismatch
The OAuth callback returned a state value that didn’t match
what we generated. Refusing the token is the only safe move.
Cancelled(String)
The user (or the platform) cancelled the OAuth flow in the
browser. The String carries the platform-supplied reason.
Timeout(Duration)
The OAuth handshake didn’t complete within the allotted time.
BadRequest(String)
Caller-side problem — usually a malformed input (e.g. a token that contains bytes we can’t put in an HTTP header).
Io(Error)
Local I/O failure (loopback bind, socket read/write, …).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()