Show on custom exceptions in Julia 0.6

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

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)

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

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.)

Filed an issue:

1 Like