# `Skuld.Comp.MatchFailed`
[🔗](https://github.com/mccraigmccraig/skuld/blob/main/lib/skuld/comp/match_failed.ex#L1)

Represents a pattern match failure in a `comp` block.

When a `<-` binding in a `comp` block with an `else` clause fails to match,
a `%MatchFailed{}` is thrown via `Throw.throw/1`. The `else` handler can
then pattern match on the unmatched value to provide recovery.

## Example

    comp do
      {:ok, x} <- maybe_returns_error()
      x
    else
      {:error, reason} -> {:failed, reason}
    end

If `maybe_returns_error()` returns `{:error, :not_found}`, the pattern
`{:ok, x}` fails to match, and `%MatchFailed{value: {:error, :not_found}}`
is thrown. The else handler catches this and matches against the value.

## Uncaught Match Failures

If a match failure is not handled by the else clause (no pattern matches),
it propagates as `%Comp.Throw{error: %MatchFailed{value: ...}}`.

# `t`

```elixir
@type t() :: %Skuld.Comp.MatchFailed{value: term()}
```

---

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