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.
```rust
/// The error kind
enum ErrorKind { MyErrorA, Testolope }
// Define our custom error type define_error!(Error);
/// A function that will always fail
fn will_fail() -> Result<(), Error
// Will panic with a nice fully-backtraced error will_fail().unwrap(); ```
This crate currently has two feature gates:
- force_backtrace
(enabled by default): Use Backtrace::force_capture
(instead of Backtrace::capture
) to always
capture a backtrace regardless whether RUST_BACKTRACE
is set or not.
- derive_display
(enabled by default): Use the Display
-trait for Etrace<MyType>
using the Debug
representation
of MyType
(instead of the Display
representation). This way you can pretty-print the underlying error types
without the necessity to manually implement the Display
-trait for them.