When going through the changelog for the latest release of Erlang, I noticed that error messages have been improved. This is great news for people learning the language since the syntax is odd enough already.

For example, here’s Erlang’s ever so friendly way of telling you that you’ve called an undefined function in 5.5.2:

1> good:error().
** exited: {undef,[{good,error,[]},
               {erl_eval,do_apply,5},
               {shell,exprs,6},
               {shell,eval_loop,3}]} **

And the new error messages in 5.6.3

1> good:error().
** exception error: undefined function good:error/0

Also from the new release:

2> Square = fun(X) -> X * X end.
#Fun
3> Square(3).
9
4> Square(good_error).
** exception error: bad argument in an arithmetic expression
    in operator  */2
        called as good_error * good_error

Compare that to the previous release:

2> Square = fun(X) -> X * X end.
#Fun
3> Square(3).
9
4> Square(hard_to_understand_error).

=ERROR REPORT==== 22-Jan-2009::10:40:53 ===
Error in process <0.32.0> with exit value: {badarith,[{erl_eval,eval_op,3},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {badarith,[{erl_eval,eval_op,3},
              {shell,exprs,6},
              {shell,eval_loop,3}]} **

I’m excited to finally have readable errors when I’m bungling around with Erlang. If only the error reporting were better when I started.