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
tracingspan 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: SourceLocationSource 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: BacktraceCaptured backtrace at the point this frame was created. Should always be considered Internal sensitivity.
span: SpanThe 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: SpanTraceThe span trace captured from tracing-error.
Implementations§
Source§impl ErrorFrame
impl ErrorFrame
Sourcepub fn new<E: Error + Send + Sync + 'static>(error: E) -> Self
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.
Sourcepub fn from_dyn_error(error: Box<dyn Error + Send + Sync + 'static>) -> Self
pub fn from_dyn_error(error: Box<dyn Error + Send + Sync + 'static>) -> Self
Create a new error frame from a boxed dynamic error.
Sourcepub fn from_message<S: Into<String>>(msg: S) -> Self
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.
Sourcepub fn get_error_title(&self) -> String
pub fn get_error_title(&self) -> String
Get the error message as a string.
Sourcepub fn get_span_list(&self) -> Vec<&'static Metadata<'static>>
pub fn get_span_list(&self) -> Vec<&'static Metadata<'static>>
Get the list of tracing span metadata from the span trace.
Sourcepub fn create_backtrace_string(&self) -> String
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.