diff --git a/src/Types.jl b/src/Types.jl index 4f47605768..3e7a5177d8 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -110,7 +110,7 @@ struct PkgError <: Exception msg::String end pkgerror(msg::String...) = throw(PkgError(join(msg))) -Base.show(io::IO, err::PkgError) = print(io, err.msg) +Base.showerror(io::IO, err::PkgError) = print(io, err.msg) ############### diff --git a/test/pkg.jl b/test/pkg.jl index 93437640a1..37c03fb8b2 100644 --- a/test/pkg.jl +++ b/test/pkg.jl @@ -683,6 +683,12 @@ end end end +@testset "PkgError printing" begin + err = PkgError("foobar") + @test sprint(show, err) == "PkgError(\"foobar\")" + @test sprint(showerror, err) == "foobar" +end + include("repl.jl") include("api.jl") include("registry.jl")