5 unstable releases

0.3.0 Oct 27, 2021
0.2.0 Jun 24, 2021
0.1.2 Nov 3, 2020
0.1.1 Nov 22, 2019
0.1.0 Nov 20, 2019

#784 in Rust patterns

Download history 170/week @ 2022-11-29 141/week @ 2022-12-06 285/week @ 2022-12-13 330/week @ 2022-12-20 195/week @ 2022-12-27 184/week @ 2023-01-03 212/week @ 2023-01-10 182/week @ 2023-01-17 172/week @ 2023-01-24 353/week @ 2023-01-31 165/week @ 2023-02-07 204/week @ 2023-02-14 201/week @ 2023-02-21 197/week @ 2023-02-28 187/week @ 2023-03-07 138/week @ 2023-03-14

775 downloads per month
Used in medea-jason

BlueOak-1.0.0

20KB
406 lines

tracerr

Latest version Rust 1.56+ Rust docs CI Unsafe Forbidden

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:6
rust_out
  at src/lib.rs:9",
);

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:6
rust_out
  at src/lib.rs:9",
);

License

Copyright © 2019 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

~1.1–1.6MB
~36K SLoC