#[non_exhaustive]pub enum Error {
Config(String),
InvalidRequest(String),
Api(ApiError),
Connection(String),
Decode(String),
}Expand description
Errors returned by this SDK.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Config(String)
The client is misconfigured (e.g. a missing API key or invalid URL).
InvalidRequest(String)
The request failed client-side validation before anything was sent.
Api(ApiError)
The API returned an unsuccessful HTTP response (after any retries).
Connection(String)
The request could not be sent, or the connection failed (after any retries). Includes request timeouts.
Decode(String)
A successful response body could not be decoded.
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
The HTTP status code, if this is an API error.
Sourcepub fn is_authentication(&self) -> bool
pub fn is_authentication(&self) -> bool
Whether the request failed authentication (HTTP 401).
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Whether the request was rate-limited or the service was overloaded (HTTP 429 or 529).
Sourcepub fn is_validation(&self) -> bool
pub fn is_validation(&self) -> bool
Whether the request body failed server-side validation (HTTP 400 or 422).
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more