Skip to content

Commit

Permalink
Improve exception stack printing (JuliaLang#36606)
Browse files Browse the repository at this point in the history
The expanded stacktrace printing introduced in JuliaLang#36134 and the fact that
we no longer print errors in red (JuliaLang#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 authored and simeonschaub committed Aug 11, 2020
1 parent 40355e1 commit dcd1dbc
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

0 comments on commit dcd1dbc

Please sign in to comment.