#[non_exhaustive]pub enum Error {
Auth(Box<ErrorDetails>),
Plan(Box<ErrorDetails>),
RateLimit(Box<ErrorDetails>),
Validation(Box<ErrorDetails>),
NotFound(Box<ErrorDetails>),
Conflict(Box<ErrorDetails>),
Server(Box<ErrorDetails>),
Api(Box<ErrorDetails>),
Timeout(String),
Connection(Error),
Decode(String),
Config(String),
}Expand description
Every error returned by a Floopy-only resource.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auth(Box<ErrorDetails>)
HTTP 401, or 403 without a feature field.
Plan(Box<ErrorDetails>)
HTTP 403 with a feature field: the current plan does not include
the requested capability (see ErrorDetails::feature).
RateLimit(Box<ErrorDetails>)
HTTP 429 (see ErrorDetails::retry_after_seconds).
Validation(Box<ErrorDetails>)
HTTP 400.
NotFound(Box<ErrorDetails>)
HTTP 404.
Conflict(Box<ErrorDetails>)
HTTP 409.
Server(Box<ErrorDetails>)
HTTP 5xx.
Api(Box<ErrorDetails>)
Any other non-2xx response.
Timeout(String)
The request exceeded its deadline.
Connection(Error)
A network failure talking to the gateway.
Decode(String)
A 2xx response whose body could not be decoded.
Config(String)
Invalid client configuration (e.g. an empty API key).
Implementations§
Source§impl Error
impl Error
Sourcepub fn details(&self) -> Option<&ErrorDetails>
pub fn details(&self) -> Option<&ErrorDetails>
The structured detail for gateway-originated errors, if any.
Sourcepub fn status(&self) -> Option<u16>
pub fn status(&self) -> Option<u16>
The HTTP status code, when the error originated from a response.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
The X-Request-Id of the failed request, when present.
Sourcepub fn feature(&self) -> Option<&str>
pub fn feature(&self) -> Option<&str>
The plan capability the request needed, for Error::Plan.
Sourcepub fn retry_after_seconds(&self) -> Option<u64>
pub fn retry_after_seconds(&self) -> Option<u64>
The Retry-After hint in seconds, for Error::RateLimit.
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()