catch, exit, and throw

Learn how to raise errors with the help of catch, exit, and throw.

Elixir code and the underlying Erlang libraries can raise the second kind of error. These are generated when a process calls error, exit, or throw. All three take a parameter, which is available to the catch handler.

Example

Here’s an example to describe catch, exit, and throw:

Get hands-on with 1300+ tech skills courses.