Behaviour of exit

Ulf Wiger <>
Mon Jan 28 13:40:20 CET 2002

On Mon, 28 Jan 2002, Joe Armstrong wrote:

>If we return to the fac/1 example, the error occurs when I try
>to do arithmetic on an atom i.e. I call fac(N) -> N*fac(N-1)
>with N = abc this makes the recursive call fac(N-1) and tries
>to compute abc-1.
>At this point I would expect the exception to be
>{badarith,'-',1,abc} (say) and I'd expect the *value* of (catch
>fac(abc)) to be {'EXIT',{badarith,'-',1,abc}}. I do not expect
>to be told the *context* of the call (from the shell) - this is

I do not agree that the context is irrelevant. However, I think
value and context should be more clearly and consistently

The (full) context is often invaluable when trying to locate the
root cause of an error in a large system - especially if the
error occurs in non-pure code.


More information about the erlang-questions mailing list