How to get last error message from REPL?

Is there a quick way to re-display the last error message from REPL, without the stacktrace?

julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1] throw_complex_domainerror(f::Symbol, x::Float64)
   @ Base.Math ./math.jl:33
 [2] sqrt
   @ ./math.jl:677 [inlined]
 [3] sqrt(x::Int64)
   @ Base.Math ./math.jl:1491
 [4] top-level scope
   @ REPL[5]:1

julia> err.stack[1].exception
DomainError(-1.0, "sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).")
4 Likes

so err here is a system generated variable? I often times use it in my code for numerical error value. It looks like my err will be overwritten in REPL if an error occurred: I guess this is something to live with? Not a big deal though. Thanks.

julia> err=1e-3
0.001

julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1] throw_complex_domainerror(f::Symbol, x::Float64)
   @ Base.Math ./math.jl:33
 [2] sqrt
   @ ./math.jl:677 [inlined]
 [3] sqrt(x::Int64)
   @ Base.Math ./math.jl:1491
 [4] top-level scope
   @ REPL[19]:1

julia> err
1-element ExceptionStack:
DomainError with -1.0:

If your own errs are in functions or any other delimited scope, there is no conflict between them.