pub struct Failure<E> { /* private fields */ }Expand description
An error with diagnostics captured where it is wrapped, which can be retained and reported later.
Capture at the failure boundary to preserve its origin before returning the value across async tasks. Backtrace::capture honours RUST_BACKTRACE and RUST_LIB_BACKTRACE; a supplied backtrace may instead be passed to Self::with_backtrace. Span traces require the error layer included by crate::Console::layer.
Implementations§
Source§impl<E> Failure<E>
impl<E> Failure<E>
Sourcepub fn capture(error: E) -> Self
pub fn capture(error: E) -> Self
Capture the current backtrace, when enabled, and logical span context.
Sourcepub fn with_backtrace(error: E, backtrace: Backtrace) -> Self
pub fn with_backtrace(error: E, backtrace: Backtrace) -> Self
Retain a previously captured backtrace and capture the current span context.
Sourcepub fn span_trace(&self) -> Option<&str>
pub fn span_trace(&self) -> Option<&str>
A text snapshot of the logical span context at capture time, if available.
Sourcepub fn into_inner(self) -> E
pub fn into_inner(self) -> E
Recover the underlying error, discarding the captured diagnostics.
Trait Implementations§
Source§impl<E: Error + 'static> Error for Failure<E>
impl<E: Error + 'static> Error for Failure<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl<E> !Freeze for Failure<E>
impl<E> RefUnwindSafe for Failure<E>where
E: RefUnwindSafe,
impl<E> Send for Failure<E>where
E: Send,
impl<E> Sync for Failure<E>where
E: Sync,
impl<E> Unpin for Failure<E>where
E: Unpin,
impl<E> UnsafeUnpin for Failure<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for Failure<E>where
E: UnwindSafe,
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> 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<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
Source§type Instrumented = TracedError<E>
type Instrumented = TracedError<E>
The type of the wrapped error after instrumentation
Source§fn in_current_span(self) -> <E as InstrumentError>::Instrumented
fn in_current_span(self) -> <E as InstrumentError>::Instrumented
Instrument an Error by bundling it with a SpanTrace Read more