Skip to content
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
merged 1 commit into from Oct 24, 2017

Commits on Oct 19, 2017

  1. Clarify output when printing nested exception traces

    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
    Simon Coffey committed Oct 19, 2017
    Copy the full SHA
    f7774e8 View commit details
    Browse the repository at this point in the history