There are three main ways to handle exceptions in serial Erlang:
- throws (
throw(Term)) - errors (
erlang:error(Reason)) - outputs (
exit(Reason))
Throws , (, , ). , , . , stdlib, - {error, Reason}, try...catch, . , .
, , . , . , if case ... of , , , , .. ( , ).
, , . , , , , - .
( , , !), , . .
(: http://learnyousomeerlang.com/errors-and-exceptions)
- . - (/ ), , : , , , , .
: exit(Pid, Reason). "exit" . process_flag(trap_exit, true) , receive.
, , exit(Pid, kill), - . , Pid, {'EXIT', killed}.
- , , . , , ; , .