Differences between extending `Base.show` and `Base.showerror` for a custom exception type in Julia?

I’m working on a Julia project where I have defined a custom exception type like this:

struct XXXError <: Exception

Now, I want to customize how instances of this exception type are displayed. I understand that I can achieve this by extending either the Base.show or Base.showerror function. However, I’m not entirely sure about the differences between these two functions and in which situations I should use each.

From what I understand, Base.show is a general function used to display objects in Julia, while Base.showerror is specifically used to display error messages. Is my understanding correct? I see most Exception types just define Base.showerror.

Could someone please explain the key differences between extending Base.show and Base.showerror for a custom exception type? And could you also provide guidance on when to use each? Thank you.

From the example in the documentation, I kind of get it:

julia> struct MyException <: Exception

julia> function Base.showerror(io::IO, err::MyException)
           print(io, "MyException: ")
           print(io, err.msg)

julia> err = MyException("test exception")
MyException("test exception")

julia> sprint(showerror, err)
"MyException: test exception"

julia> throw(MyException("test exception"))
ERROR: MyException: test exception
julia> err = MyException("test exception")
MyException("test exception")

This line implicitly calls show and is equivalent to show(err):

julia> show(err)
MyException("test exception")

while showerror is only used when throw is called. Is it correct?