6 releases (3 breaking)
0.3.1 | Aug 28, 2024 |
---|---|
0.3.0 | Aug 28, 2024 |
0.2.1 | Aug 28, 2024 |
0.1.0 | Aug 23, 2024 |
0.0.1 | Aug 23, 2024 |
#721 in Debugging
187 downloads per month
6KB
102 lines
Error Backtrace
This is a simple crate to debug where your errors are comming from. With the smallest possiable amount of code.
Usage
cargo add error-backtrace
- Add
use error_backtrace::{Result, ResultBacktrace};
where you useResult
and.backtrace()
to backtrace them - And add
.into()
where the error is created. (Compiler will help you with this) - Where you read errors use
error.inner
or*error
Example:
use error_backtrace::{Result, ResultBacktrace};
#[derive(Debug)]
struct Error;
fn main() -> Result<(), Error> {
maybe_error().backtrace()?;
Ok(())
}
fn maybe_error() -> Result<(), Error> {
error_source()?;
Ok(())
}
fn error_source() -> Result<(), Error> {
Err(Error {}.into())
}
Dependencies
~0–5MB
~10K SLoC