I am trying to get an error message of a caught exception for use in a warning.
For example, while following
julia> a = 3+b
ERROR: UndefVarError: b not defined
Stacktrace:
[1] top-level scope
@ REPL[1]:1
says that the problem is that b
is not defined, the following method of handling exception has much less helpful message:
julia> try
a = 3+b
catch e
@warn "Bad thing happend: $e"
end
┌ Warning: Bad thing happend: UndefVarError(:b)
└ @ Main REPL[2]:4
How do I get the error message and stacktrace from the exception as String?