Appendix 1
Exceptions: raise and try, catch and throw

Elixir (like Erlang) takes the view that errors should normally be fatal to the processes in which they occur. A typical Elixir application’s design involves many processes, which means the effects of an error will be localized. A supervisor will detect the failing process, and the restart will be handled at that level.

For that reason, you won’t find much exception-handling code in Elixir programs. Exceptions are raised, but you rarely catch them.

Use exceptions for things that are exceptional—things that should never happen.

Exceptions do exist. This appendix is an overview of how to generate them and how to catch them when they occur.