scoped-error 0.1.3

Structured error handling with semantic context trees. Zero proc-macros. Zero backtrace overhead.
Documentation
// Copyright (C) 2026 Kan-Ru Chen <kanru@kanru.info>
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

use scoped_error::{ErrorExt, expect_error, impl_context_error};

fn do_work() -> Result<(), CustomError> {
    expect_error("Failed to do something", || {
        internal()?;
        Ok(())
    })
}
fn internal() -> Result<(), CustomError> {
    expect_error("Failed due to internal error", || {
        Err("Failed to perform IO")?;
        Ok(())
    })
}

impl_context_error!(CustomError);

#[test]
fn it_works() {
    let Err(error) = do_work() else {
        panic!("unexpected success");
    };
    assert_eq!(
        error.report().to_string(),
        "Failed to do something, at tests/custom.rs:9:9\n|-- Failed due to internal error, at tests/custom.rs:15:9\n`-- Failed to perform IO"
    );
}