Crates.io | tracerr |
lib.rs | tracerr |
version | 0.3.0 |
source | src |
created_at | 2019-11-20 15:52:18.358629 |
updated_at | 2021-10-27 10:17:55.172552 |
description | Custom compile-time captured error tracing. |
homepage | https://github.com/instrumentisto/tracerr-rs |
repository | https://github.com/instrumentisto/tracerr-rs |
max_upload_size | |
id | 183002 |
size | 24,127 |
Custom compile-time captured error tracing for Rust.
The common rule:
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",
);
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.