Skip to main content

Diagnostic

Trait Diagnostic 

Source
pub trait Diagnostic: Error {
    // Provided methods
    fn oopsie_backtrace(&self) -> Option<&Backtrace> { ... }
    fn oopsie_spantrace(&self) -> Option<&SpanTrace> { ... }
    fn oopsie_location(&self) -> Option<&'static Location<'static>> { ... }
    fn oopsie_error_code(&self) -> Option<ErrorCode> { ... }
    fn oopsie_help_text(&self) -> Option<HelpText> { ... }
    fn oopsie_exit_code(&self) -> Option<NonZeroU8> { ... }
}
Expand description

Trait for errors that expose diagnostic data.

Always implemented by #[derive(Oopsie)]. Provides a stable mechanism for extracting backtraces, span traces, error codes, and help text without relying on the unstable Provide/Request API.

Provided Methods§

Source

fn oopsie_backtrace(&self) -> Option<&Backtrace>

Returns the backtrace captured when this error was created.

Source

fn oopsie_spantrace(&self) -> Option<&SpanTrace>

Returns the span trace captured when this error was created.

Source

fn oopsie_location(&self) -> Option<&'static Location<'static>>

Returns the caller location captured when this error was created.

Source

fn oopsie_error_code(&self) -> Option<ErrorCode>

Returns the error code associated with this error.

Source

fn oopsie_help_text(&self) -> Option<HelpText>

Returns the help text associated with this error.

Source

fn oopsie_exit_code(&self) -> Option<NonZeroU8>

Returns the process exit code this error should terminate with.

Honored by Report’s Termination impl on stable. NonZeroU8 is what ExitCode::from accepts portably, and zero would denote success on a path that is, by construction, a failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Diagnostic> Diagnostic for Arc<T>

Source§

impl<T: Diagnostic> Diagnostic for Box<T>

Implementors§