https://github.com/instrumentisto/tracerr-rs
Custom compile time captured error tracing for Rust
https://github.com/instrumentisto/tracerr-rs
rust rust-backtrace rust-error rust-stacktrace rust-tracerr rust-tracing
Last synced: 6 months ago
JSON representation
Custom compile time captured error tracing for Rust
- Host: GitHub
- URL: https://github.com/instrumentisto/tracerr-rs
- Owner: instrumentisto
- License: other
- Created: 2019-11-20T09:20:16.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T08:58:09.000Z (about 1 year ago)
- Last Synced: 2025-04-13T09:55:41.427Z (about 1 year ago)
- Topics: rust, rust-backtrace, rust-error, rust-stacktrace, rust-tracerr, rust-tracing
- Language: Rust
- Homepage: https://docs.rs/tracerr
- Size: 81.1 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
tracerr
=======
[](https://crates.io/crates/tracerr)
[](https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html)
[](https://github.com/rust-secure-code/safety-dance)\
[](https://github.com/instrumentisto/tracerr-rs/actions?query=workflow%3ACI+branch%3Amain)
[](https://docs.rs/tracerr)
[API Docs](https://docs.rs/tracerr) |
[Changelog](https://github.com/instrumentisto/tracerr-rs/blob/v0.4.0/CHANGELOG.md)
Custom compile-time captured error tracing for [Rust].
## Usage
The common rule:
- Use macro to capture trace frame in the invocation place.
```rust,no_run
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();
assert_eq!(
format!("{err}\n{}", 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();
assert_eq!(
format!("{val}\n{trace}"),
r"my error
error trace:
rust_out
at src/lib.rs:6
rust_out
at src/lib.rs:9",
);
```
## License
Copyright © 2019-2025 Instrumentisto Team,
This software is subject to the terms of the [Blue Oak Model License 1.0.0](https://github.com/instrumentisto/tracerr-rs/blob/v0.4.0/LICENSE.md). If a copy of the [BlueOak-1.0.0](https://spdx.org/licenses/BlueOak-1.0.0.html) license was not distributed with this file, You can obtain one at .
[Rust]: https://rust-lang.org