CaseClauseError exception (Elixir v1.19.0-rc.0)

View Source

An exception raised when a term in a case/2 expression does not match any of the defined -> clauses.

For example:

iex> case System.unique_integer() do
...>   bin when is_binary(bin) -> :oops
...>   :ok -> :neither_this_one
...> end
** (CaseClauseError) no case clause matching:
...

The following fields of this exception are public and can be accessed freely:

  • :term (term/0) - the term that did not match any of the clauses