backtrace

Macro backtrace 

Source
macro_rules! backtrace {
    () => { ... };
}
Expand description

Captures the current backtrace as lazy error context.

This macro creates a LazyContext that captures the stack backtrace only when the error actually occurs, avoiding the performance overhead of backtrace generation on the success path.

The backtrace is captured using std::backtrace::Backtrace::capture() and converted to a string representation when the context is evaluated.

ยงExamples

use error_rail::{backtrace, ComposableError};

let err = ComposableError::<&str, u32>::new("panic occurred")
    .with_context(backtrace!());