Crates.io | error-backtrace |
lib.rs | error-backtrace |
version | 0.3.1 |
source | src |
created_at | 2024-08-23 09:51:39.788009 |
updated_at | 2024-08-28 17:15:50.501277 |
description | Simple crate to backtrace your errors |
homepage | |
repository | https://gitlab.com/the-SSD/error-backtrace |
max_upload_size | |
id | 1348970 |
size | 10,833 |
This is a simple crate to debug where your errors are comming from. With the smallest possiable amount of code.
cargo add error-backtrace
use error_backtrace::{Result, ResultBacktrace};
where you use Result
and .backtrace()
to backtrace them.into()
where the error is created. (Compiler will help you with this)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())
}