#[non_exhaustive]pub enum Error {
Config(String),
InvalidRequest(String),
Api(Box<ApiError>),
Connection {
source: Error,
},
Timeout {
timeout: Duration,
},
Decode {
message: String,
request_id: Option<String>,
source: Option<Error>,
},
Credentials {
source: BoxError,
},
UnexpectedAnswer {
name: String,
reason: String,
},
}Expand description
Everything a client call can fail with.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
The client configuration is missing or invalid.
InvalidRequest(String)
The request was rejected before it was sent.
Api(Box<ApiError>)
The server answered with a non-2xx status after retries.
Connection
The request or the response body failed in transit (DNS, TLS, reset).
Timeout
The full response did not arrive within the per-attempt timeout.
Decode
A 2xx response body did not have the expected shape.
Fields
Credentials
The credential provider failed, timed out, or returned an unusable token.
The message never includes the token. Not retried.
UnexpectedAnswer
An answer is missing, has another type, or uses a label the typed key doesn’t know.
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
The HTTP status, for Error::Api.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
The server’s request ID, when the response carried one.
Sourcepub fn api_error(&self) -> Option<&ApiError>
pub fn api_error(&self) -> Option<&ApiError>
The API error, for Error::Api.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Whether the call timed out.
Sourcepub fn is_connection(&self) -> bool
pub fn is_connection(&self) -> bool
Whether the call failed in transit. Timeouts count as connection errors.
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()