Struct Error
pub struct Error { /* private fields */ }
The Errors that may occur when processing a Request.
Note: Errors may include the full URL used to make the Request. If the URL
contains sensitive information (e.g. an API key as a query parameter), be
sure to remove it (without_url)
Implementations
impl Error
fn url(&self) -> Option<&Url>Returns a possible URL related to this error.
Examples
# asyncfn url_mut(&mut self) -> Option<&mut Url>Returns a mutable reference to the URL related to this error
This is useful if you need to remove sensitive information from the URL (e.g. an API key in the query), but do not want to remove the URL entirely.
fn with_url(self, url: Url) -> SelfAdd a url related to this error (overwriting any existing)
fn without_url(self) -> SelfStrip the related url from this error (if, for example, it contains sensitive information)
fn is_builder(&self) -> boolReturns true if the error is from a type Builder.
fn is_redirect(&self) -> boolReturns true if the error is from a
RedirectPolicy.fn is_status(&self) -> boolReturns true if the error is from
Response::error_for_status.fn is_timeout(&self) -> boolReturns true if the error is related to a timeout.
fn is_request(&self) -> boolReturns true if the error is related to the request
fn is_connect(&self) -> boolReturns true if the error is related to connect
fn is_body(&self) -> boolReturns true if the error is related to the request or response body
fn is_decode(&self) -> boolReturns true if the error is related to decoding the response's body
fn status(&self) -> Option<StatusCode>Returns the status code, if the error was generated from a response.
fn is_upgrade(&self) -> boolReturns true if the error is related to a protocol upgrade request
Trait Implementations
impl Debug for Error
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for Error
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Error for Error
fn source(&self) -> Option<&dyn StdError + 'static>
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations
impl<T> Any for Error
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Error
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Error
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Error
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for Error
impl<T> PolicyExt for Error
where
T: ?Sized,
fn and<P, B, E>(self, other: P) -> And<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,fn or<P, B, E>(self, other: P) -> Or<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,
impl<T> ToString for Error
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T> WithSubscriber for Error
impl<T, U> Into<U> for Error
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Error
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Error
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>