6 releases (3 breaking)

0.4.0 Feb 4, 2025
0.3.0 Oct 27, 2021
0.2.0 Jun 24, 2021
0.1.2 Nov 3, 2020
0.1.1 Nov 22, 2019

#323 in Rust patterns

Download history 18/week @ 2024-11-17 26/week @ 2024-11-24 104/week @ 2024-12-01 142/week @ 2024-12-08 83/week @ 2024-12-15 24/week @ 2024-12-22 46/week @ 2024-12-29 49/week @ 2025-01-05 102/week @ 2025-01-12 30/week @ 2025-01-19 56/week @ 2025-01-26 149/week @ 2025-02-02 199/week @ 2025-02-09 86/week @ 2025-02-16 98/week @ 2025-02-23 198/week @ 2025-03-02

593 downloads per month
Used in medea-jason

BlueOak-1.0.0

23KB
473 lines

tracerr

crates.io Rust 1.75+ Unsafe Forbidden
CI Rust docs

API Docs | Changelog

Custom compile-time captured error tracing for Rust.

Usage

The common rule:

  • Use macro to capture trace frame in the invocation place.
use tracerr::Traced;

let err = tracerr::new!("my error"); // captures frame

let res: Result<(), _> = Err(err)
    .map_err(tracerr::wrap!()); // captures frame

let err: Traced<&'static str> = res.unwrap_err();
# #[cfg(not(target_os = "windows"))]
assert_eq!(
    format!("{}\n{}", err, err.trace()),
    r"my error
error trace:
rust_out
  at src/lib.rs:7
rust_out
  at src/lib.rs:10",
);

let (val, trace) = err.split();
# #[cfg(not(target_os = "windows"))]
assert_eq!(
    format!("{}\n{}", val, trace),
    r"my error
error trace:
rust_out
  at src/lib.rs:7
rust_out
  at src/lib.rs:10",
);

License

Copyright © 2019-2025 Instrumentisto Team, https://github.com/instrumentisto

This software is subject to the terms of the Blue Oak Model License 1.0.0. If a copy of the BlueOak-1.0.0 license was not distributed with this file, You can obtain one at https://blueoakcouncil.org/license/1.0.0.

Dependencies

~325–800KB
~18K SLoC