#[non_exhaustive]pub enum Error {
Http(HttpError),
#[non_exhaustive] Status {
code: u16,
body: String,
},
Unauthorized,
Forbidden,
#[non_exhaustive] RateLimited {
retry_after: Option<Duration>,
},
Unauthenticated,
Deserialize(Error),
Io(Error),
Utf8(FromUtf8Error),
#[non_exhaustive] Oauth {
error: String,
description: Option<String>,
},
}Expand description
Errors returned by this crate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Http(HttpError)
Transport-level failure (DNS, TLS, connection, timeout).
#[non_exhaustive]Status
Non-2xx response that does not map to a more specific variant.
Fields
This variant is marked as non-exhaustive
401 Unauthorized from the API.
Forbidden
403 Forbidden from the API.
#[non_exhaustive]RateLimited
429 Too Many Requests. retry_after is set if the server sent Retry-After.
Fields
This variant is marked as non-exhaustive
Unauthenticated
An API call was made on a client with no access token (and no refresh token to mint one). Every TONE3000 endpoint requires a Bearer access token.
Deserialize(Error)
Response body could not be deserialized.
Io(Error)
Failure writing a streamed download to the provided writer.
Utf8(FromUtf8Error)
A downloaded body was expected to be UTF-8 text (e.g. .nam JSON) but was not.
#[non_exhaustive]Oauth
OAuth token endpoint returned an error body.
Fields
This variant is marked as non-exhaustive
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
The request timed out.
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
The failure happened while establishing the connection.
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()