TryClauseError exception (Elixir v1.19.0-dev)

View Source

An exception raised when none of the else clauses in a try/1 match.

For example:

iex> try do
...>   :ok
...> rescue
...>   e -> e
...> else
...>   # :ok -> :ok is missing
...>   :not_ok -> :not_ok
...> end
** (TryClauseError) no try clause matching: :ok

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