Is it possible to have the line of an error?

WILLIAMS Dominic D.WILLIAMS@REDACTED
Wed Jul 9 11:36:38 CEST 2003


Hello,

I have been trying to write Erlang code in the "let it fail" philosophy, e.g.

{ok, Content} = file:read_file(filename:join("c:/tmp","test"))

instead of:

case file:read_file(filename:join("c:/tmp","test")) of
    {ok, Content} ->
        handle_content(Content);
    {error, Reason} ->
        {error, {read_failed,Reason}}
end.

As a beginner in Erlang, one problem I have with this is that when it does fail, the information provided (from the shell, for example) is sufficient to know there was a badmatch in a given function, but not at which line in the function.

Is it possible to know the line of the failure? I am looking for something like compile options or activating traces, rather than peppering my code with macros and ?LINE...

Cheers,

Dominic.



More information about the erlang-questions mailing list