pub enum Error {
RateLimited(Option<Instant>),
BadRequest,
BadAccessToken,
BadOAuthScope,
NotFound(Option<String>),
Server(Option<StatusCode>, Error),
Http(Error),
Serialization(Error),
Redirect(Error),
Client(Option<StatusCode>, Error),
Other(Error),
}
Expand description
Represents an error encountered when sending a request.
Errors may come from a variety of sources, but the ones handled most directly by this crate are client errors. If a client error occurs, we map it to a user-friendly error variant; if another error occurs, we just wrap it and return it. This means that errors stemming from your mistakes are easier to diagnose than errors from the middleware stack.
Variants
RateLimited(Option<Instant>)
The API is enforcing a rate limit. The associated value is the time at which the rate limit will be lifted, if it was specified.
BadRequest
The request was malformed and should not be reattempted (HTTP 400 or 422). If this came from library methods, please create an issue. If you’re using a custom color somewhere, please first validate it. Otherwise, check for empty strings.
BadAccessToken
The specified access token was invalid (HTTP 401).
BadOAuthScope
The requested OAuth scope was invalid (HTTP 403).
NotFound(Option<String>)
The given selector (or scene UUID) did not match anything associated with this account (HTTP 404). The URL is returned as well, if possible, to help with troubleshooting.
Server(Option<StatusCode>, Error)
The API server encountered an error, but the request was (seemingly) valid (HTTP 5xx).
Http(Error)
An HTTP stack error was encountered.
Serialization(Error)
A serialization error was encountered.
Redirect(Error)
A bad redirect was encountered.
Client(Option<StatusCode>, Error)
A miscellaneous client error occurred (HTTP 4xx).
Other(Error)
Some other error occured.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
impl<T> AsFail for Twhere
T: Fail,
impl<T> AsFail for Twhere
T: Fail,
fn as_fail(&self) -> &(dyn Fail + 'static)
fn as_fail(&self) -> &(dyn Fail + 'static)
Self
into a dynamic trait object of Fail
.sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<E> Fail for Ewhere
E: 'static + Error + Send + Sync,
impl<E> Fail for Ewhere
E: 'static + Error + Send + Sync,
fn cause(&self) -> Option<&(dyn Fail + 'static)>
fn cause(&self) -> Option<&(dyn Fail + 'static)>
fn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
Backtrace
carried by this failure, if it
carries one. Read more