pub trait ErrorExt:
Error
+ Send
+ Sync
+ 'static {
// Provided methods
fn raise(self) -> Error
where Self: Sized { ... }
fn raise_typed(self) -> Exn<Self>
where Self: Sized { ... }
fn and_raise<T: Error + Send + Sync + 'static>(self, context: T) -> Error
where Self: Sized { ... }
fn and_raise_typed<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
Raise native errors with caller locations and optional context.
Provided Methods§
Sourcefn raise_typed(self) -> Exn<Self>where
Self: Sized,
fn raise_typed(self) -> Exn<Self>where
Self: Sized,
Raise this error as a typed exception, retaining Self even when it is already an Error.
Sourcefn and_raise<T: Error + Send + Sync + 'static>(self, context: T) -> Errorwhere
Self: Sized,
fn and_raise<T: Error + Send + Sync + 'static>(self, context: T) -> Errorwhere
Self: Sized,
Raise this error as a cause of context, returning a public Error.
Tree-backed crate::Error values reuse their existing frame, retaining its original caller location.
Sourcefn and_raise_typed<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>where
Self: Sized,
fn and_raise_typed<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>where
Self: Sized,
Like Self::and_raise(), retaining the context’s type in an exception.
Sourcefn raise_erased(self) -> Exnwhere
Self: Sized,
fn raise_erased(self) -> Exnwhere
Self: Sized,
Raise this error as a new exception, with type erasure.
Tree-backed crate::Error values reuse their existing frame and caller location.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".