tor-error: backtrace captured by `BugRepr` should be formatted using `Display` rather than `Debug`
When you log a tor_error::Bug
(for example created through tor_error::internal!
), the backtrace is logged with its debug representation.
For example:
error!("{}", tor_error::internal!("foo").report());
outputs:
2024-10-23T22:29:30Z ERROR tor_chanmgr::mgr::state: error: internal error (bug) at crates/tor-chanmgr/src/mgr/state.rs:611:26: foo
Backtrace [{ fn: "tor_error::internal::ie_backtrace::capture", file: "./crates/tor-error/src/internal.rs", line: 21 }, { fn: "tor_error::internal::Bug::new_inner", file: "./crates/tor-error/src/internal.rs", line: 105 }, [...]
This seems to be due to:
impl Display for Captured {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Debug::fmt(&self.0, f)
}
}
in crates/tor-error/src/internal.rs
.
Maybe there was a reason for using the Debug
impl rather than Display
?
Edited by opara