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 |
#1654 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 useResultand.backtrace()to backtrace them - And add
.into()where the error is created. (Compiler will help you with this) - Where you read errors use
error.inneror*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–710KB
~14K SLoC