Exception handling
You may be familiar with the concept of exceptions from other languages. Thus, you may be tempted to think of them similarly when coming to Elixir. However, like many things we have covered so far, and many things we will cover, we need to forget most what we have learned when learning most concepts of functional programming and Elixir.
Elixir offers some basic facilities for raising and catching exceptions.
First and foremost, exceptions in Elixir are not control flow or branching structures. Exceptions are meant strictly for exceptional behaviour, that is, things that should absolutely not happen is happening. Some examples of exceptions are database servers going down, name servers failing, or attempting to open a fixed location configuration file. However, failing to open a file whose name is given by a user is not an exception; this is entirely something we can, as programmers, anticipate failing.
This boils down to the assumptions made about a system when it is programmed...