Description
I think it would really be to our benefit to clean up how errors are printed in Julia. Examples:
julia> complex(1,2) > 0
ERROR: no method isless(Int64,Complex{Int64})
in > at operators.jl:19
This doesn't tell me anything about the type of the error (in case I wanted to catch
it, for instance), but does tell me something mildly helpful; namely that I attempted to call a function that doesn't exist.
julia> a = []
0-element Array{None,1}
julia> a[-1]
ERROR: BoundsError()
in getindex at array.jl:277
julia> iround(Inf)
ERROR: InexactError()
in iround at float.jl:79
On the other hand, these tell me the type of the error but don't tell me much beyond that. It'd be nice to have some kind of human-readable string to make this a little friendlier.
julia> parse("9223372036854775808")
ERROR: ParseError("invalid numeric constant 9223372036854775808")
in parse at string.jl:1199
in parse at string.jl:1212
This is the nicest so far because everything I'm looking for is there (type for catching, description, etc....), however it's not exactly printed in the nicest way; it's printed out in faux-"AST literal" fashion. I don't know if there's a much better way to print exceptions out, but I'm willing to think about it if others agree.
I'd like to propose that when exceptions in Base
throw and are printed to the console, that they are represented with their type, a human-readable description of the error (simple exceptions such as BoundsError()
could have a default boilerplate so as to not have developers copy-pasting the same string everywhere)