rerun
rerun copied to clipboard
`anyhow::Error::to_string` doesn't print the full context
This has bitten us many times. That's why we have re_error::format.
anyhowhas no intention of changing this behavior: https://discord.com/channels/1062300748202921994/1373859622443548803/1373859622443548803eyrehas the same problem: https://github.com/eyre-rs/eyre/issues/234
According to https://github.com/dtolnay/anyhow/issues/85, using format!("{err:#}") instead of err.to_string() prints the whole context.
let err = anyhow::format_err!("root_cause")
.context("inner_context")
.context("outer_context");
assert_eq!(
format!("{:#}", err),
"outer_context: inner_context: root_cause"
);
Another place where disallowed trait methods would be super useful:
- https://github.com/rust-lang/rust-clippy/issues/15765
Is there an open source bounty program for such things?