error-backtrace 0.2.0

Simple crate to backtrace your errors
Documentation
error-backtrace-0.2.0 has been yanked.

Error Backtrace

This is a simple crate to debug where your errors are comming from.

Installation

cargo add error-backtrace

Usage

How this is supposed to be used:

fn main() -> Result<(), ()> {
    let value = maybe_error().backtrace()?;
    Ok(())
}

fn maybe_error() -> Result<(), ()> {
    let value = error_source()?;
    let value2 = match error_source().handle_error() {
        Ok(x) => x,
        Err(_) => (),
    };

    Ok(())
}

fn error_source() -> Result<(), ()> {
    Err(()).trace()
}

How this is not supposed to be used:

fn main() -> Result<(), ()> {
    // Don't use trace at every step, only at the origin of the error
    let value = maybe_error().trace()?;
    Ok(())
}

fn maybe_error() -> Result<(), ()> {
    // Don't use trace at every step, only at the origin of the error
    let value = error_source().trace()?;
    let value2 = match error_source().handel_error() {
        Ok(x) => x,
        Err(_) => ()
    };

    Ok(())
}

fn error_source() -> Result<(), ()> {
    Err(()).trace()
}