Enum lifxi::http::Error

source ·
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

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Converts a reference to Self into a dynamic trait object of Fail.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Returns the “name” of the error. Read more
Returns a reference to the underlying cause of this failure, if it is an error that wraps other errors. Read more
Returns a reference to the Backtrace carried by this failure, if it carries one. Read more
Provides context for this failure. Read more
Wraps this failure in a compatibility wrapper that implements std::error::Error. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.