pub trait ErrorExt:
Error
+ Send
+ Sync
+ 'static {
// Provided methods
fn raise(self) -> Exn<Self>
where Self: Sized { ... }
fn and_raise<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>
where Self: Sized { ... }
fn raise_erased(self) -> Exn
where Self: Sized { ... }
fn raise_all<T, I>(self, sources: I) -> Exn<Self>
where Self: Sized,
T: Error + Send + Sync + 'static,
I: IntoIterator,
I::Item: Into<Exn<T>> { ... }
}Expand description
A trait bound of the supported error type of Exn.
Provided Methods§
Sourcefn and_raise<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>where
Self: Sized,
fn and_raise<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>where
Self: Sized,
Raise this error as a child of a new exception with the given context error.
This is a shorthand for self.raise().raise(context) — it wraps self in an Exn
and immediately nests it under a new Exn<T> headed by context.
ⓘ
// Instead of:
io_err.raise().raise(message("could not read file"))
// Write:
io_err.and_raise(message("could not read file"))Sourcefn raise_erased(self) -> Exnwhere
Self: Sized,
fn raise_erased(self) -> Exnwhere
Self: Sized,
Raise this error as a new exception, with type erasure.