#[non_exhaustive]pub enum Error {
Api(Box<ApiError>),
Transport(TransportError),
Decode(DecodeError),
Config(&'static str),
}Expand description
What went wrong with a call. Every variant wraps a type of its own, so a caller can match the kind and keep the details.
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.
Api(Box<ApiError>)
The server answered with a status other than 2xx.
Transport(TransportError)
No answer arrived: the connection failed, an attempt timed out, or the overall deadline passed.
Decode(DecodeError)
A 2xx answer did not have the documented shape.
Config(&'static str)
The client could not be built, or a request could not be formed from its options (for example a base URL that is not a URL).
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<u16>
pub fn status(&self) -> Option<u16>
The HTTP status of an Error::Api; None for the other kinds.
Sourcepub fn problem(&self) -> Option<&Problem>
pub fn problem(&self) -> Option<&Problem>
The problem of an Error::Api; None for the other kinds.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Whether this is a TransportError caused by a timeout or the
deadline.
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()
Source§impl From<DecodeError> for Error
impl From<DecodeError> for Error
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<TransportError> for Error
impl From<TransportError> for Error
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Error
impl Move for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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