pub struct Error { /* private fields */ }Expand description
An error encountered when communicating with the service.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new<E>(kind: ErrorKind, error: E) -> Error
pub fn new<E>(kind: ErrorKind, error: E) -> Error
Create a new Error based on an ErrorKind and an underlying error cause.
Sourcepub fn with_error<E, C>(kind: ErrorKind, error: E, message: C) -> Error
pub fn with_error<E, C>(kind: ErrorKind, error: E, message: C) -> Error
Create a new Error based on an ErrorKind, an underlying error cause, and a message.
Sourcepub fn with_error_fn<E, F, C>(kind: ErrorKind, error: E, f: F) -> Error
pub fn with_error_fn<E, F, C>(kind: ErrorKind, error: E, f: F) -> Error
Create a new Error based on an ErrorKind, an underlying error cause, and a function that returns a message.
Sourcepub fn with_message<C>(kind: ErrorKind, message: C) -> Error
pub fn with_message<C>(kind: ErrorKind, message: C) -> Error
Create an Error based on an ErrorKind and a message.
Sourcepub fn with_message_fn<F, C>(kind: ErrorKind, f: F) -> Error
pub fn with_message_fn<F, C>(kind: ErrorKind, f: F) -> Error
Creates an Error based on an ErrorKind and a function that returns a message.
Sourcepub fn with_context<C>(self, message: C) -> Error
pub fn with_context<C>(self, message: C) -> Error
Wrap this error with an additional message.
Sourcepub fn with_context_fn<F, C>(self, f: F) -> Error
pub fn with_context_fn<F, C>(self, f: F) -> Error
Wrap this error with an additional message returned from a function.
Sourcepub fn http_status(&self) -> Option<StatusCode>
Available on crate feature http only.
pub fn http_status(&self) -> Option<StatusCode>
http only.If this error is an HTTP response error, return the associated status code.
Sourcepub fn into_inner(self) -> Result<Box<dyn Error + Send + Sync>, Error>
pub fn into_inner(self) -> Result<Box<dyn Error + Send + Sync>, Error>
Consumes the Error, returning its inner error, if any.
Sourcepub fn into_downcast<T>(self) -> Result<T, Error>where
T: Error + 'static,
pub fn into_downcast<T>(self) -> Result<T, Error>where
T: Error + 'static,
Consumes the error, attempting to downcast the inner error as the type provided.
Returns Err(self) if the downcast is not possible.
Sourcepub fn get_ref(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
pub fn get_ref(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
Returns a reference to the inner error wrapped by this error, if any.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: Error + 'static,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: Error + 'static,
Returns a reference to the inner error, if any, downcast to the type provided.
Sourcepub fn get_mut(&mut self) -> Option<&mut (dyn Error + Send + Sync + 'static)>
pub fn get_mut(&mut self) -> Option<&mut (dyn Error + Send + Sync + 'static)>
Returns a mutable reference to the inner error wrapped by this error, if any.
Sourcepub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: Error + 'static,
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: Error + 'static,
Returns a mutable reference to the inner error, if any, downcasting to the type provided.
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
Source§impl From<DecodeError> for Error
impl From<DecodeError> for Error
Source§fn from(error: DecodeError) -> Error
fn from(error: DecodeError) -> Error
Source§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
Source§fn from(error: FromUtf8Error) -> Error
fn from(error: FromUtf8Error) -> Error
Source§impl From<Infallible> for Error
impl From<Infallible> for Error
Source§fn from(_: Infallible) -> Error
fn from(_: Infallible) -> Error
Source§impl From<ParseBoolError> for Error
impl From<ParseBoolError> for Error
Source§fn from(error: ParseBoolError) -> Error
fn from(error: ParseBoolError) -> Error
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(error: ParseError) -> Error
fn from(error: ParseError) -> Error
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(error: ParseIntError) -> Error
fn from(error: ParseIntError) -> Error
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.