Crate ebacktrace[−][src]
Expand description
ebacktrace
Welcome to ebacktrace 🎉
This crate implements a simple error wrapper which captures a backtrace upon creation and can carry an optional textual description of the error.
Example
ⓘ
#![feature(backtrace)] #[macro_use] extern crate ebacktrace; /// The error kind #[derive(Debug, Copy, Clone)] enum ErrorKind { MyErrorA, Testolope } // Define our custom error type define_error!(Error); /// A function that will always fail fn will_fail() -> Result<(), Error<ErrorKind>> { Err(ErrorKind::Testolope)? } // Will panic with a nice fully-backtraced error will_fail().unwrap();
Features
This crate currently has two feature gates:
force_backtrace(enabled by default): If this feature is enabled, the crate usesBacktrace::force_capture(instead ofBacktrace::capture) to always capture a backtrace regardless of whetherRUST_BACKTRACEis set or not.derive_display(enabled by default): Implements theDisplay-trait forEtrace<MyType>using theDebugrepresentation ofMyType(instead of theDisplayrepresentation). This way you can pretty-print the underlying error types without the necessity to manually implement theDisplay-trait for them.
Macros
Defines a custom error with descripion