Show on custom exceptions in Julia 0.6

question

#1

I’m having some issues with throw not calling showerror on custom exceptions. I’m pretty sure that this is a bug but I just wanted to check that this wasn’t intentional:

julia> type MyUndefVarError <: Exception
           var::Symbol
       end

julia> Base.showerror(io::IO, e::MyUndefVarError) = print(io, e.var, " not defined");

julia> showerror(STDOUT, UndefVarError(:foo))
UndefVarError: foo not defined

julia> showerror(STDOUT, MyUndefVarError(:foo))
foo not defined

julia> throw(UndefVarError(:foo))
ERROR: UndefVarError: foo not defined

julia> throw(MyUndefVarError(:foo))  # Should show `ERROR: foo not defined`
ERROR: MyUndefVarError(:foo)

#2

I forgot to mention: Julia 0.6.0-dev.1898 (2e0b00180)


#3

I think it’s a bug. Base.display_error(e, catch_backtrace()) works fine, so I think the problem is that it’s being called with an obsolete world-age. (This is the rather tricky new feature that @vtjnash implemented to solve #265, so that functions are automatically recompiled when dependent functions are changed. Unfortunately, it has subtle effects for code like the REPL itself, which is both running and also evaluating user code.)


#4

Filed an issue: https://github.com/JuliaLang/julia/issues/19864