Skip to main content

ErrorFrame

Struct ErrorFrame 

Source
pub struct ErrorFrame {
    pub message: ErrorSensitivityLabel<String>,
    pub error: Box<dyn Error + Send + Sync + 'static>,
    pub source: SourceLocation,
    pub date_time: DateTime<Utc>,
    pub suggestions: Vec<ErrorSensitivityLabel<String>>,
    pub context: ErrorSensitivityLabel<String>,
    pub attachments: HashMap<String, Box<ErrorSensitivityLabel<ErrorAttachment>>>,
    pub backtrace: Backtrace,
    pub span: Span,
    pub span_trace: SpanTrace,
}
Expand description

A single frame in an error chain, capturing one error with its full context.

Each ErrorFrame records:

  • The error message and original error object
  • Source location (file, line, column) via #[track_caller]
  • Timestamp of when the frame was created
  • Backtrace at the point of creation
  • Current tracing span and span trace
  • Arbitrary key-value attachments with sensitivity labels

Frames are collected inside an ErrorReport.

Fields§

§message: ErrorSensitivityLabel<String>

Error message text, wrapped in a sensitivity label.

§error: Box<dyn Error + Send + Sync + 'static>

The original error object.

§source: SourceLocation

Source code location where this frame was created.

§date_time: DateTime<Utc>

Timestamp of when this error frame was created (UTC).

§suggestions: Vec<ErrorSensitivityLabel<String>>

Suggestions that could help resolve the error.

§context: ErrorSensitivityLabel<String>

Context/circumstances the error occurred in.

§attachments: HashMap<String, Box<ErrorSensitivityLabel<ErrorAttachment>>>

Key-value attachments with sensitivity labels for additional diagnostic data.

§backtrace: Backtrace

Captured backtrace at the point this frame was created. Should always be considered Internal sensitivity.

§span: Span

The current tracing Span when this frame was created. Should always be considered Internal sensitivity. This can be used instead of Backtrace for creating a stack.

§span_trace: SpanTrace

The span trace captured from tracing-error.

Implementations§

Source§

impl ErrorFrame

Source

pub fn new<E: Error + Send + Sync + 'static>(error: E) -> Self

Create a new error frame from any error type.

Captures source location, backtrace, timestamp, and current tracing span.

Source

pub fn from_dyn_error(error: Box<dyn Error + Send + Sync + 'static>) -> Self

Create a new error frame from a boxed dynamic error.

Source

pub fn from_message<S: Into<String>>(msg: S) -> Self

Create an error frame from a plain message string.

The message is labeled as Internal.

Source

pub fn get_error_title(&self) -> String

Get the error message as a string.

Source

pub fn get_span_list(&self) -> Vec<&'static Metadata<'static>>

Get the list of tracing span metadata from the span trace.

Source

pub fn create_backtrace_string(&self) -> String

Resolve and format the backtrace as a human-readable string.

Cleans up paths by removing the current directory prefix, cargo registry paths, and rustlib paths to keep output concise.

Trait Implementations§

Source§

impl Debug for ErrorFrame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ErrorFmt for ErrorFrame

Source§

fn create_format_obj( &self, settings: ErrorFmtSettings, ) -> ResultER<ErrorFormatObj>

Convert this value into a structured format object.
Source§

fn stringify(&self, settings: ErrorFmtSettings) -> ResultER<String>

Convert to string by first creating a format object, then stringifying it.
Source§

fn stringify_obj( format_obj: ErrorFormatObj, settings: ErrorFmtSettings, ) -> ResultER<String>

Stringify an existing format object directly.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more