Skip to content

Commit

Permalink
Merge #1080
Browse files Browse the repository at this point in the history
1080: Overload Base.showerror instead of Base.show for PkgError. r=fredrikekre a=fredrikekre



Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
  • Loading branch information
bors[bot] and fredrikekre committed Feb 20, 2019
2 parents 616bd61 + cae8b4f commit f3c1ce1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)


###############
Expand Down
6 changes: 6 additions & 0 deletions test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,12 @@ end
end
end

@testset "PkgError printing" begin
err = PkgError("foobar")
@test occursin("PkgError(\"foobar\")", sprint(show, err))
@test sprint(showerror, err) == "foobar"
end

include("repl.jl")
include("api.jl")
include("registry.jl")
Expand Down

0 comments on commit f3c1ce1

Please sign in to comment.