# Is it possible/advisable to have multiline error message?

**URL:** https://discourse.julialang.org/t/is-it-possible-advisable-to-have-multiline-error-message/104513
**Category:** General Usage
**Tags:** question
**Created:** [October 2, 2023, 8:31pm UTC](https://discourse.julialang.org/t/is-it-possible-advisable-to-have-multiline-error-message/104513 "2023-10-02T20:31:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![David\_Sagan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_sagan/32/33792_2.png) [@David\_Sagan](https://discourse.julialang.org/u/David_Sagan)
#### Post date: [October 2, 2023, 8:31pm UTC](https://discourse.julialang.org/t/is-it-possible-advisable-to-have-multiline-error-message/104513/1 "2023-10-02T20:31:50Z")

</div>

`throw` shows a multiline (has `\n` characters) string as a single line. Example:

```julia
julia> throw("a\n b")
ERROR: "a\n b"
Stacktrace:
  [1] top-level scope
  @ REPL[3]:1

```

Is it possible to have a multiline error message? Is there some reason why this would not be advisable?

Thanks for all the help.

---

<div class="post-metadata">

### Author: ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)
#### Post date: [October 2, 2023, 9:44pm UTC](https://discourse.julialang.org/t/is-it-possible-advisable-to-have-multiline-error-message/104513/2 "2023-10-02T21:44:31Z")

</div>

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

```
