GEN-152: report::from
should load recursive .source()
information from std::error::Error
-compatible errors
#4355
Labels
area/libs > error-stack
Affects the `error-stack` crate (library)
area/libs
Relates to first-party libraries/crates/packages (area)
category/bug
Something isn't working
lang/rust
Pull requests that update Rust code
state/duplicate
This issue or pull request already exists
Describe the bug
Report::from currently ignores nested .source() results of std::error::Error-compliant types.
For anyhow and eyre errors there's a compat module which loads their nested errors, but there's nothing like this for basic std::error::Error like the ones generated from thiserror::Error.
To reproduce
prints error:
while it shoud include nested errors along the lines of
Expected behavior
Errors that have std::error::Error::source() implemented in a nested manner, like reqwest-midleware::Error which contains reqwest::Error should have their sources displayed recursively in the display output.
Recursive nesting of errors is the currently default paradigm of nesting errors in the rust ecosystem and should be supported.
Example:
Error: MyContext
├╴at location
│
╰─▶ Request error: error sending request for url (http://localhost:9999/)
├╴backtrace with 28 frames (1)
├╴at location
├╴error sending request for url (http://localhost:9999/)
├╴client error (Connect)
├╴tcp connect error: Connection refused (os error 111)
╰╴Connection refused (os error 111)
The above was achieved using this abomination:
Rust compiler
rustc 1.78.0-nightly (5119208fd 2024-03-02)
Host
x86_64-unknown-linux-gnu
Target
x86_64-unknown-linux-gnu
Version
v0.4.1
Features
default
Additional context
No response
The text was updated successfully, but these errors were encountered: