11.4 Exit Reasons

When a run-time error occurs, that is an exception of class error. The exit reason is a tuple {Reason,Stack}, where Reason is a term indicating the type of error:

ReasonType of Error
badargBad argument. The argument is of wrong data type, or is otherwise badly formed.
badarithBad argument in an arithmetic expression.
{badmatch,V}Evaluation of a match expression failed. The value V did not match.
function_clauseNo matching function clause is found when evaluating a function call.
{case_clause,V}No matching branch is found when evaluating a case expression. The value V did not match.
if_clauseNo true branch is found when evaluating an if expression.
{try_clause,V}No matching branch is found when evaluating the of-section of a try expression. The value V did not match.
undefThe function cannot be found when evaluating a function call.
{badfun,F}Something is wrong with a fun F.
{badarity,F}A fun is applied to the wrong number of arguments. F describes the fun and the arguments.
timeout_valueThe timeout value in a receive..after expression is evaluated to something else than an integer or infinity.
noprocTrying to link to a non-existing process.
{nocatch,V}Trying to evaluate a throw outside a catch. V is the thrown term.
system_limitA system limit has been reached. See Efficiency Guide for information about system limits.

Table 11.2: Exit Reasons

Stack is the stack of function calls being evaluated when the error occurred, given as a list of tuples {Module,Name,Arity} with the most recent function call first. The most recent function call tuple can in some cases be {Module,Name,[Arg]}.