phd: include error cause chain in failure output #606
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when
phd
tests fail by returning ananyhow::Error
, the code for formatting the error message only includes the top-level error. When an error has a complex cause chain --- as most of the internal framework errors inphd
do, due to use ofanyhow::Context
--- this means that most of the error information is discarded in the test output. For example, a test failure might currently look like this:This branch changes the error output to use the default
fmt::Debug
implementation foranyhow::Error
, which includes the top-level error, the entire cause chain if the error has a cause, and the backtrace, if one was captured.Now, the output for the same test failing looks like this:
Or, if
RUST_BACKTRACE=1
is set, like this:The additional information from the error's cause chain should come in handy while debugging test failures.