# Make Julia’s Error Codes Even Better Than Elm’s

**URL:** <https://discourse.julialang.org/t/make-julia-s-error-codes-even-better-than-elm-s/87409>\
**Category:** Internals & Design\
**Created:** [September 17, 2022, 4:26pm UTC](https://discourse.julialang.org/t/make-julia-s-error-codes-even-better-than-elm-s/87409 "2022-09-17T16:26:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [September 17, 2022, 7:23pm UTC](https://discourse.julialang.org/t/make-julia-s-error-codes-even-better-than-elm-s/87409/3 "2022-09-17T19:23:54Z")

</div>

Maybe we can start by reading that post and looking at examples of Julia’s errors and considering how they could be more beginner-friendly.

```julia
xs = [1,2,3]
xs[0]

```

```julia
% julia tmp.jl      
ERROR: LoadError: BoundsError: attempt to access 3-element Vector{Int64} at index [0]
Stacktrace:
 [1] getindex(A::Vector{Int64}, i1::Int64)
   @ Base ./array.jl:861
 [2] top-level scope
   @ /tmp/tmp.uyTu9zl540/tmp.jl:2
in expression starting at /tmp/tmp.uyTu9zl540/tmp.jl:2

```

Rewriting the error:

```julia
1 | xs = [1,2,3]
2 | xs[0] 
    ^^^^^

I tried to access a Vector{Int64} at index [0] but the valid indexes are 
[1], [2], [3].

The stack of function calls, from latest to earliest, was:
 [1] getindex(A::Vector{Int64}, i1::Int64)
   @ Base ./array.jl:861
 [2] top-level scope
   @ /tmp/tmp.uyTu9zl540/tmp.jl:2

```

- arrows point at the location in the code, with context. Does julia currently have the ability to isolate code spans so that the `^^^^` arrows can work?
- the valid indexes are mentioned
- uses full sentences
- uses “I” for the compiler, which does have a more relatable tone IMHO
- doesn’t introduce “stacktrace” jargon

---

_[View the full topic](https://discourse.julialang.org/t/make-julia-s-error-codes-even-better-than-elm-s/87409)._
