IJulia.jl
IJulia.jl copied to clipboard
Errors in Base.show are silently ignored if fallback methods are available
To reproduce, run following in Jupyter:
struct MyType
end;
Base.show(io::IO, m::MIME"text/plain", v::MyType) = println(io, "plain text")
Base.show(io::IO, m::MIME"text/html", v::MyType) = error("HTML Error!")
MyType()
This produces plain text
, without any mention of the error.
I am not sure if this is the intended behavior, but it was certainly puzzling for me when I was debugging complex Base.show(io::IO, m::MIME"text/html", ...)
method in Jupyter. It would be great if there was a warning that the fallback show
method is getting used, the user could then use try-catch in the method to print the error.
Running
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_REVISE_POLL = 1