[erlang-questions] Line number in errors: badmatch, case clause, badarith

caio ariede <>
Tue Jan 12 15:30:00 CET 2010


It works with this type of error too?

> test:foo().
** exception error: no function clause matching test:bar(1)

  1 -module(test).
  2 -compile(export_all).
  3
  4 foo() ->
  5     bar(1).
  6
  7 bar(0) -> 0.

There is a way to get what line (5) the error occurred?

Caio Ariede
http://caioariede.com/


On Tue, Jan 12, 2010 at 10:11 AM, Thomas Lindgren
<> wrote:
>
>
>
>
> ----- Original Message ----
> > From: Max Lapshin <>
> > To: Erlang-Questions Questions <>
> > Sent: Tue, January 12, 2010 8:16:42 AM
> > Subject: [erlang-questions] Line number in errors: badmatch, case clause, badarith
> >
> > Is it hard to change format of runtime errors to include line number,
> > where error appeared.
> > I understand, that it is impossible to understand, on which line
> > function arguments hasn't matched,
> > but it is clearly determined, on which line badmatch or badarith has happened.
> >
> > Are there hidden problems with such error information?
>
>
> I think the compiler should add such info to exceptions, but it hasn't happened yet. In the meantime, you could try this: git://github.com/thomasl/smart_exceptions.git
>
> (The "devel" version seems to work fairly well, but no promises.)
>
> Best,
> Thomas
>
> PS. Given that OTP has taken the fantastic step of using github, maybe I ought to submit that patch myself?
>
>
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>


More information about the erlang-questions mailing list