#[non_exhaustive]pub enum Error {
Show 16 variants
Config(String),
InvalidRequest(String),
MissingAnswer {
id: String,
expected: &'static str,
},
BadRequest {
message: String,
},
Authentication {
message: String,
},
PermissionDenied {
message: String,
},
NotFound {
message: String,
},
UnprocessableEntity {
message: String,
},
RateLimit {
retry_after: Option<Duration>,
message: String,
},
Overloaded {
retry_after: Option<Duration>,
message: String,
},
Server {
status: u16,
message: String,
},
UnexpectedStatus {
status: u16,
message: String,
},
Connection(Error),
Timeout(Error),
ResponseValidation(Error),
RequestSerialization(Error),
}Expand description
Errors returned by Client.
HTTP-status variants carry the response body (truncated) as message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
Missing API key or otherwise unusable client configuration.
InvalidRequest(String)
The request was not sendable as built (no state, no questions, bad option set).
MissingAnswer
The response has no answer of the expected type under this id.
Fields
BadRequest
Authentication
401: missing or invalid API key.
PermissionDenied
NotFound
UnprocessableEntity
422: the request body failed validation.
RateLimit
429: rate limit exceeded after all retries.
Fields
Overloaded
529: TypeSafe is temporarily overloaded, after all retries.
Fields
Server
Any other 5xx, after all retries.
UnexpectedStatus
Any other unexpected status.
Connection(Error)
The request never produced a response (DNS, connect, TLS, reset).
Timeout(Error)
The request exceeded its timeout.
ResponseValidation(Error)
The response body did not match the documented schema.
RequestSerialization(Error)
Failed to serialize the request body.
Implementations§
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()