erlang:fault/1 vs. erlang:exit/1
Tue May 30 13:39:02 CEST 2006
Just a friendly reminder that thanks to Richard Carlsson's EUC talk we
know that the best way to signal a crash-error is by calling
erlang:fault(Reason) and not erlang:exit(Reason). This is because
'fault' will helpfully wrap the crash reason with a backtrace saying
where it comes from whereas exit will not.
8> catch erlang:fault(foo).
9> catch erlang:exit(foo).
This makes crashes caused by 'fault' much easier to track down than
ones caused by 'exit'. I suggest using 'fault' as your default choice.
I was a bit confused today while trying to track down a crash with
reason 'badarg' (no backtrace) which turned out to come from an 'exit'
in gen_tcp:connect/4. Maybe that could be a 'fault' instead.
More information about the erlang-questions