[erlang-questions] Re: Getting line number in backtrace?

Brian Candler B.Candler@REDACTED
Mon Dec 6 14:23:15 CET 2010


On Fri, Dec 03, 2010 at 12:27:44PM -0600, Scott Lystig Fritchie wrote:
> I'm a smart_exceptions fan.  IIRC I just removed that guard:
> 
>     [...]
>     mapform0(F, C) ->
>         C.

I see git has been updated to remove that guard. Now it compiles fine, and
also tells me the line number of the error, yay :-)

$ erlc -pa . +debug_info +'{parse_transform, smart_exceptions}' my_test.erl 
$ erl +Bc
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
1> my_test:go().
{foo,bar}** exception exit: {{my_test,dostuff,1},{line,10},match,[{foo,bar}]}
     in function  my_test:dostuff/1
     in call from my_test:go/0

It doesn't give me the line numbers of the outer calls, but it's definitely
an improvement.  (And yes, I realise that tail calls won't appear in the
backtrace at all; I'm fine with that)

Cheers,

Brian.


More information about the erlang-questions mailing list