# `Spek.EvaluationError`
[🔗](https://github.com/woylie/spek/blob/0.2.0/lib/spek/evaluation_error.ex#L1)

Error representing a failed rule evaluation.

# `t`

```elixir
@type t() :: %Spek.EvaluationError{
  __exception__: term(),
  expression: Spek.expression() | nil,
  message: String.t(),
  results: [term()] | nil
}
```

Struct returned or raised if an authorization check fails.

`expression` contains the parts of the policy expression that were performed
and their results. Depending on the evaluation function used, this may be the
complete expression, or only the parts of it that were evaluated until a
decision was made.

`results` contains the collected error reasons as returned by
`Spek.collect_results/2`.

# `new`

```elixir
@spec new(String.t()) :: t()
```

Returns a new `EvaluationError` struct.

# `put_results`

```elixir
@spec put_results(t()) :: t()
```

Collects the error results with `Spek.collect_results/2` and puts them into
the given `EvaluationError` struct.

# `with_expression`

```elixir
@spec with_expression(String.t(), Spek.expression()) :: t()
```

Returns a new `EvaluationError` struct that contains the given expression.

---

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