-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify output when printing nested exception traces #232
Merged
hsbt
merged 1 commit into
ruby:master
from
urbanautomaton:clarify-exception-cause-output
Oct 24, 2017
Merged
Clarify output when printing nested exception traces #232
hsbt
merged 1 commit into
ruby:master
from
urbanautomaton:clarify-exception-cause-output
Oct 24, 2017
Conversation
This file contains 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
urbanautomaton
force-pushed
the
clarify-exception-cause-output
branch
from
October 19, 2017 12:48
a96fdcf
to
71b02b5
Compare
Since v10.2.0, if an exception has a nested cause exception, the cause is also displayed in the trace output.[1] For heavily-nested exceptions, this output can be quite lengthy - for example, Rails migrations nest DB errors twice over, resulting in an error message and backtrace repeated three times. To break up this output and make it clearer what each individual backtrace relates to, this adds whitespace and a "Caused by:" label to each nested exception being displayed. To prevent "Caused by:" labels occurring on their own, I've moved the exception loop shortcut return into the `#display_cause_details` method. This doesn't alter the behaviour of the shortcut, as only the first exception will be unconditionally printed (which was already the case, as the first exception can't be already seen). [1] ruby@fbb22e7 [2] ruby@57c932c
urbanautomaton
force-pushed
the
clarify-exception-cause-output
branch
from
October 19, 2017 12:52
71b02b5
to
f7774e8
Compare
@urbanautomaton Thanks for your suggestion. This pull-request makes clarify problem of exceptions for users. |
Thank you! ❤️ |
I released rake-12.2.0 contained your pull request. Please try it |
That's great - all working, thanks again. |
This was referenced Mar 22, 2018
This was referenced Mar 22, 2018
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.
Since v10.2.0, if an exception has a nested cause exception, the cause is also displayed in the trace output.
For deeply-nested exceptions, this output can be quite lengthy - for example, Rails migrations nest DB errors twice over, resulting in an error message and backtrace repeated three times. With long backtraces, this output can be difficult to visually scan.
To break up the output and make it clearer what each individual backtrace relates to, this PR adds whitespace and a "Caused by:" label to each nested exception being displayed.
Given the following
Rakefile
:This changes the output from this in current
master
:To this:
Is this a change you'd be interested in merging? If so, feedback on both the output and implementation would be very welcome, and I'd be happy to make any changes necessary.
Cheers,
Simon