# `JevDSL.Error`
[🔗](https://github.com/boxxxie/jev_dsl/blob/v0.1.0/lib/jev_dsl/error.ex#L1)

Structured exception raised by `evaluate!/3` and `JevDSL.Runner.evaluate!/4` when a
`JevDSL` contract evaluation fails.

## Fields

  * `:type` - Error classification atom (`:no_api_key`, `:cache_miss`, `:unknown_contract`, `:invalid_options`, or `:evaluation_failed`).
  * `:message` - Human-readable error message.
  * `:contract` - The contract key (atom or string) being evaluated, if applicable.
  * `:details` - Additional error context or underlying failure term.

# `error_type`

```elixir
@type error_type() ::
  :no_api_key
  | :cache_miss
  | :unknown_contract
  | :invalid_options
  | :evaluation_failed
```

# `t`

```elixir
@type t() :: %JevDSL.Error{
  __exception__: true,
  contract: atom() | String.t() | nil,
  details: term(),
  message: String.t(),
  type: error_type()
}
```

# `cache_miss`

```elixir
@spec cache_miss(atom() | String.t() | nil) :: t()
```

Builds a `:cache_miss` exception when `cache_only: true` is set and the evaluation is not in L1/L2 cache.

# `from_reason`

```elixir
@spec from_reason(term(), atom() | String.t() | nil) :: Exception.t()
```

Converts an error reason from `evaluate/3` into a raisable exception (`JevDSL.Error` or `SystemOneSDK.Error`).

# `invalid_options`

```elixir
@spec invalid_options(String.t(), term()) :: t()
```

Builds an `:invalid_options` exception when invalid options are supplied.

# `no_api_key`

```elixir
@spec no_api_key(atom() | String.t() | nil) :: t()
```

Builds a `:no_api_key` exception when neither a `TYPESAFE_API_KEY` nor an offline cache/mock is available.

# `unknown_contract`

```elixir
@spec unknown_contract(module(), atom() | String.t()) :: t()
```

Builds an `:unknown_contract` exception when a contract key is not defined on the module.

---

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