Improve utils.FatalError error formatting#34417
Merged
strideynet merged 4 commits intomasterfrom Nov 20, 2023
Merged
Conversation
utils.FatalError utils.FatalError error formatting
Contributor
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
tigrato
approved these changes
Nov 10, 2023
codingllama
reviewed
Nov 13, 2023
codingllama
approved these changes
Nov 13, 2023
Contributor
codingllama
left a comment
There was a problem hiding this comment.
Seems reasonable to me, as is the change in error messages overall.
|
@strideynet See the table below for backport results.
|
This was referenced Nov 20, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I've noticed the past few months a number of cases where users reporting an issue with
tbotwere confused by the error message output bytbot.A contributing factor to this is that they appear "scrambled". This scrambling appears to be caused by
utils.formatErrorWriterwhich prints the Messages from deepest to shallowest, and then prints the underlying error. But - this makes no sense - the underlying error is the deepest element. You can see an example of this below.I noticed that when
-dwas provided, a different implementation was used to print the error. This implementation is within ourtracepackage, and correctly shows the messages from shallowest to deepest - and also indents each message. This helps distinguish each message and is especially important when printing a stack including an aggregate error. So - I figured it made sense to reuse that implementation.Example Code:
Prior to this PR:
After this PR:
If we feel the risk this change is too wide for
utils.FatalError, I'm more than happy to isolate this fix totbot.nb: I'm also currently investigating an issue within
tracewhen pretty printing aggregate errors. I hope to raise a PR for that soonish as part of a general effort to improvetbot's error output.