Pkg.jl
Pkg.jl copied to clipboard
`ResolverError` coloring should be decided in `showerror`, not on construction
A ResolverError
has color hardcoded in the message if stderr
supports color, as the message is formatted on construction using the following function:
https://github.com/JuliaLang/Pkg.jl/blob/8b2c0f32939042e5d77da05d2825de6ec56487e9/src/Resolve/graphtype.jl#L571-L576
This is unfortunate when the error message isn't actually printed to stderr
, for example in Pluto:
Perhaps it would be better to store data rather than a preformatted message in the ResolverError
object, and only format the message in the showerror(io, ::ResolverError)
method, with or without color depending on io
.