#[non_exhaustive]pub enum ErrorKind {
Config,
InvalidRequest,
Api(ApiError),
Connection,
Timeout {
timeout: Duration,
},
ResponseValidation(ResponseValidationError),
ResponseTooLarge {
limit: usize,
},
}Expand description
Which kind of failure an Error is.
New variants are added as the SDK learns to distinguish more failures, so
a match over this enum needs a catch-all arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config
The client could not be built: a missing or malformed API key, a base URL that is not a URL, a timeout that is zero or not finite.
InvalidRequest
The request could not be built from what the caller supplied, and was never sent.
Api(ApiError)
The server answered, and the answer was not a success status.
Connection
The request never produced an HTTP response: the connection failed, was refused, or was lost mid-flight.
Timeout
The attempt exceeded its deadline.
ResponseValidation(ResponseValidationError)
The server answered with a success status and a body this SDK could not read as the response it expected.
ResponseTooLarge
The server answered with a success status and a body larger than the client’s limit, so the body was not read past the limit and nothing was decoded.
The limit is 16 MiB unless
ClientBuilder::max_response_bytes
set another. Retrying the same request cannot help: the answer will be
as large again. A failure status with a body over the limit is an
ErrorKind::Api instead, which keeps its status and headers.