[−][src]Crate tracerr
Custom compile time captured error tracing.
Provides tools for making error output more informative. It adds ability to capture custom error trace frames (at compile time) and to display errors with the final captured trace.
Usage
The common rule:
- Use macro to capture trace frame in the invocation place.
use tracerr::Traced; let err = tracerr::new!("my error"); // captures frame let res: Result<(), _> = Err(err) .map_err(tracerr::wrap!()); // captures frame let err: Traced<&'static str> = res.unwrap_err(); assert_eq!( format!("{}\n{}", err, err.trace()), r"my error error trace: rust_out at src/lib.rs:6 rust_out at src/lib.rs:9", ); let (val, trace) = err.into_parts(); assert_eq!( format!("{}\n{}", val, trace), r"my error error trace: rust_out at src/lib.rs:6 rust_out at src/lib.rs:9", );
Macros
from_and_wrap | Provides a closure, which captures new |
map_from_and_new | Captures new |
map_from_and_wrap | Provides a closure, which captures new |
new | Captures new |
new_frame | Captures and returns new |
wrap | Provides a closure, which captures new |
Structs
Frame | Captured frame of |
Trace | Trace composed from captured |
Traced | Transparent wrapper for an error which holds captured error trace along with it. |
Statics
DEFAULT_FRAMES_CAPACITY | Default capacity for |
Traits
WrapTraced | Trait for wrapping errors into a |
Functions
map_from | Maps value of error wrapped in |