pub enum Error<E = Infallible> {
Validation {
field: String,
message: String,
},
Configuration(String),
Transport(E),
Timeout {
timeout: Duration,
},
Decode {
status: StatusCode,
request_id: Option<String>,
headers: Box<HeaderMap>,
body: Vec<u8>,
source: Error,
},
Api {
status: StatusCode,
request_id: Option<String>,
headers: Box<HeaderMap>,
body: Vec<u8>,
retry_after: Option<Duration>,
attempts: u64,
},
IncompleteEvaluation,
}Expand description
Errors returned while configuring or using a client.
Variants§
Validation
The request violates a documented API constraint.
Fields
Configuration(String)
The client configuration is invalid.
Transport(E)
The HTTP exchange failed before a response was available.
Timeout
The configured per-attempt timeout elapsed.
Decode
A successful HTTP response could not be decoded.
Fields
status: StatusCodeHTTP status returned by the API.
Api
The API returned a non-success status.
Fields
status: StatusCodeHTTP status returned by the API.
IncompleteEvaluation
An application-supplied event sequence ended before a terminal event.
Implementations§
Source§impl<E> Error<E>
impl<E> Error<E>
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Returns the associated HTTP status, when a response was received.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns the TypeSafe request id, when one was received.
Source§impl Error<Infallible>
impl Error<Infallible>
Sourcepub fn with_transport<E>(self) -> Error<E>
pub fn with_transport<E>(self) -> Error<E>
Converts a backend-neutral error to one carrying a concrete transport error type.
This is useful in custom client implementations after calling Request::validate.
Trait Implementations§
Source§impl<E> Error for Error<E>
impl<E> Error for Error<E>
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()