# `WithClauseError`
[🔗](https://github.com/elixir-lang/elixir/blob/v1.20.0-rc.3/lib/elixir/lib/exception.ex#L1562)

An exception raised when a term in a `with/1` expression
does not match any of the defined `->` clauses in its `else`.

For example, this exception gets raised for a `with/1` like the following, because
the `{:ok, 2}` term does not match the `:error` or `{:error, _}` clauses in the
`else`:

    iex> with {:ok, 1} <- {:ok, 2} do
    ...>   :woah
    ...> else
    ...>   :error -> :error
    ...>   {:error, _} -> :error
    ...> end
    ** (WithClauseError) no with clause matching:
    ...

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

  * `:term` (`t:term/0`) - the term that did not match any of the clauses

---

*Consult [api-reference.md](api-reference.md) for complete listing*
