Skip to content

Commit

Permalink
Improve exception stack printing (#36606)
Browse files Browse the repository at this point in the history
The expanded stacktrace printing introduced in #36134 and the fact that
we no longer print errors in red (#36015) makes it harder to distinguish
distinct exceptions in the stack.

Add a newline for this, and print the "caused by" in error_color(). Also
remove exception numbering which was arguably not very helpful.
  • Loading branch information
c42f committed Jul 14, 2020
1 parent 0cdbfd3 commit 29826c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ function show_exception_stack(io::IO, stack::Vector)
nexc = length(stack)
for i = nexc:-1:1
if nexc != i
printstyled(io, "caused by [exception ", i, "]\n", color=:light_black)
printstyled(io, "\ncaused by:\n", color=error_color())
end
exc, bt = stack[i]
showerror(io, exc, bt, backtrace = bt!==nothing)
Expand Down
3 changes: 2 additions & 1 deletion test/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ end
nested_error_pattern = r"""
ERROR: DivideError: integer division error
Stacktrace:.*
caused by \[exception 1\]
caused by:
UndefVarError: __not_a_binding__ not defined
Stacktrace:.*
"""s
Expand Down

2 comments on commit 29826c2

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.