From dcd1dbc0b586c83bc7e3ce9f0eb79b6b1e4e3091 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Wed, 15 Jul 2020 08:58:39 +1000 Subject: [PATCH] Improve exception stack printing (#36606) 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. --- base/errorshow.jl | 2 +- test/client.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/base/errorshow.jl b/base/errorshow.jl index 5b0c32be6194a9..9dedb67451a6ff 100644 --- a/base/errorshow.jl +++ b/base/errorshow.jl @@ -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) diff --git a/test/client.jl b/test/client.jl index 37516fb00ea911..07efd31d5ba3a5 100644 --- a/test/client.jl +++ b/test/client.jl @@ -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