5 releases

Uses new Rust 2024

0.1.2 Sep 9, 2025
0.1.1 Sep 9, 2025
0.1.0 Sep 9, 2025
0.0.2 Sep 9, 2025
0.0.1 Sep 9, 2025

#834 in Debugging

Download history 130/week @ 2025-09-03 175/week @ 2025-09-10 8/week @ 2025-10-01 375/week @ 2025-11-12 174/week @ 2025-11-19 38/week @ 2025-11-26

587 downloads per month

MIT/Apache

22KB
126 lines

err-report

crates.io Documentation Version MIT or Apache 2.0 licensed
Dependency Status Download

Clone of the unstable std::error::Report type.

Backtrace support is omitted due to nightly requirement.

Copied on 2025-09-09.

Examples

use std::ffi::CString;

use err_report::Report;

let invalid_utf8 = [b'f', 0xff, b'o', b'o'];
let c_string = CString::new(invalid_utf8).unwrap();
let err = c_string.into_string().unwrap_err();

// without Report, the source/root error is not printed
assert_eq!("C string contained non-utf8 bytes", err.to_string());

// with Report, all details in error chain are printed
assert_eq!(
    "C string contained non-utf8 bytes: invalid utf-8 sequence of 1 bytes from index 1",
    Report::new(err).to_string(),
);

No runtime deps