pub struct AppError<D = ()> { /* private fields */ }Expand description
A reference-counted untyped error that can be created from any error type.
Named AppError as it’s mostly useful in application code that don’t care
about the errors specifically, and instead only care to show them to users.
Implementations§
Source§impl<D> AppError<D>
impl<D> AppError<D>
Sourcepub fn with_context<F, M>(&self, with_msg: F) -> Self
pub fn with_context<F, M>(&self, with_msg: F) -> Self
Adds context to this error
Sourcepub fn from_multiple<Errs>(errs: Errs) -> Selfwhere
Errs: IntoIterator<Item = Self>,
pub fn from_multiple<Errs>(errs: Errs) -> Selfwhere
Errs: IntoIterator<Item = Self>,
Creates a new app error from multiple errors
Sourcepub fn from_multiple_std<'a, Errs, E>(errs: Errs) -> Self
pub fn from_multiple_std<'a, Errs, E>(errs: Errs) -> Self
Creates a new app error from multiple standard errors
Sourcepub fn as_std_error(&self) -> &(dyn StdError + 'static)where
D: Debug + 'static,
pub fn as_std_error(&self) -> &(dyn StdError + 'static)where
D: Debug + 'static,
Returns this type as a std::error::Error
Sourcepub fn into_std_error(self) -> Arc<dyn StdError + Send + Sync + 'static>
pub fn into_std_error(self) -> Arc<dyn StdError + Send + Sync + 'static>
Converts this type as into a std::error::Error
Sourcepub fn pretty(&self) -> PrettyDisplay<'_, D>
pub fn pretty(&self) -> PrettyDisplay<'_, D>
Returns an object that can be used for a pretty display of this error
Source§impl<D> AppError<D>
impl<D> AppError<D>
Sourcepub fn new_with_data<E>(err: &E, data: D) -> Self
pub fn new_with_data<E>(err: &E, data: D) -> Self
Creates a new app error from an error and data.
data will be applied to all sources of err
Sourcepub fn msg_with_data(msg: &'static str, data: D) -> Self
pub fn msg_with_data(msg: &'static str, data: D) -> Self
Creates a new app error from a message
Sourcepub fn fmt_with_data<M>(msg: M, data: D) -> Selfwhere
M: Display,
pub fn fmt_with_data<M>(msg: M, data: D) -> Selfwhere
M: Display,
Creates a new app error from a formatted message
Sourcepub fn context_with_data(&self, msg: &'static str, data: D) -> Self
pub fn context_with_data(&self, msg: &'static str, data: D) -> Self
Adds context to this error
Sourcepub fn with_context_with_data<F, M>(&self, with_msg: F, data: D) -> Self
pub fn with_context_with_data<F, M>(&self, with_msg: F, data: D) -> Self
Adds context to this error
Trait Implementations§
impl<D> Eq for AppError<D>where
D: Eq,
Auto Trait Implementations§
impl<D> Freeze for AppError<D>
impl<D> RefUnwindSafe for AppError<D>where
D: RefUnwindSafe,
impl<D> Send for AppError<D>
impl<D> Sync for AppError<D>
impl<D> Unpin for AppError<D>
impl<D> UnwindSafe for AppError<D>where
D: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more