error-backtrace

Crates.ioerror-backtrace
lib.rserror-backtrace
version0.3.1
sourcesrc
created_at2024-08-23 09:51:39.788009
updated_at2024-08-28 17:15:50.501277
descriptionSimple crate to backtrace your errors
homepage
repositoryhttps://gitlab.com/the-SSD/error-backtrace
max_upload_size
id1348970
size10,833
SSD (the-ssd)

documentation

README

Error Backtrace

This is a simple crate to debug where your errors are comming from. With the smallest possiable amount of code.

Usage

  1. cargo add error-backtrace
  2. Add use error_backtrace::{Result, ResultBacktrace}; where you use Result and .backtrace() to backtrace them
  3. And add .into() where the error is created. (Compiler will help you with this)
  4. 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())
}
Commit count: 0

cargo fmt