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 b807801 + 2450a5e commit 40c849e
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 sprint(show, err) == "PkgError(\"foobar\")"
@test sprint(showerror, err) == "foobar"
end

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

0 comments on commit 40c849e

Please sign in to comment.