Is it possible/advisable to have multiline error message?

Someone else will have to elaborate on the philosophical use of throw on non-Exception types. Maybe it has to do with not artificially constraining what can be used with try/catch? In any case, it seems that “values” like String aren’t usually meant to be thrown.

In the meantime, consider throw(ErrorException(...)) or equivalently error(...).

julia> error("hi\nthere")
ERROR: hi
there
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] top-level scope
   @ REPL[3]:1
3 Likes