11. Errors and Error Handling
11 Errors and Error Handling
11.1 Terminology
Errors can roughly be divided into four different types:
- Compile-time errors
- Logical errors
- Run-time errors
- Generated errors
A compile-time error, for example a syntax error, does not cause much trouble as it is caught by the compiler.
A logical error is when a program does not behave as intended, but does not crash. An example is that nothing happens when a button in a graphical user interface is clicked.
A run-time error is when a crash occurs. An example is when an operator is applied to arguments of the wrong type. The Erlang programming language has built-in features for handling of run-time errors.
A run-time error can also be emulated by calling erlang:error(Reason)
or erlang:error(Reason, Args)
(those appeared in Erlang 5.4/OTP-R10).
A run-time error is