[erlang-questions] Displaying the line number when error occured

Richard Carlsson richardc@REDACTED
Mon May 21 18:12:03 CEST 2007

June Kim wrote:
> ** exited: {{badmatch,5},
>             [{foo,bar,1},{shell,exprs,6},{shell,eval_loop,3}]} **
> The report isn't very helpful. Is there any way I can see the line
> number of the source code that the error occured?

As noted by others, once you get a bit of experience with Erlang, the
information in the error report is often enough to give you a good idea
of where the error occurred. But sometimes, this can be tricky to see,
especially in large functions.

So, if what you really want to do is find where the error happens (and
not necessarily just get a printout with a line number), you can run
the debugger (type 'debugger:start()' in your Erlang shell). The modules
you want trace need to be compiled with the 'debug_info' compiler option.



More information about the erlang-questions mailing list