# `Schooner.Error`
[🔗](https://github.com/ausimian/schooner/blob/1.2.0/lib/schooner/error.ex#L1)

Host-side exception raised when a Scheme `raise` / `raise-continuable`
/ `error` is not caught by any installed `with-exception-handler` or
`guard`. The struct carries the original Scheme value verbatim in
`:value`; for an error object the host can pattern-match
`{:error_obj, kind, message, irritants}` directly, or use
`irritants/1` for the common case.

This is distinct from `Schooner.Eval.Error` and
`Schooner.Primitive.Error`, which signal evaluator and primitive
failures. Those reach the host directly without passing through
the Scheme exception handlers. Values raised from Scheme or through
`Schooner.Host.raise_error/2` and `Schooner.Host.raise_value/1` end up
here when unhandled. Host code should use those helpers for errors
scripts can catch; raising `Schooner.Error` directly bypasses Scheme
handlers.

`:location` is the `Schooner.Location` of the call that raised the
value. It is only filled in when the script runs with `debug: true`;
see "Source locations" in `Schooner`. With `debug: true`,
`:scheme_backtrace` lists the procedure calls that led to the raise,
most recent first (see `Schooner.Frame`); otherwise it is `nil`.

# `t`

```elixir
@type t() :: %Schooner.Error{
  __exception__: true,
  location: Schooner.Location.t() | nil,
  message: binary() | nil,
  scheme_backtrace: [Schooner.Frame.t()] | nil,
  value: Schooner.Value.t()
}
```

# `irritants`

```elixir
@spec irritants(t()) :: [Schooner.Value.t()]
```

Return the irritants of `error`'s wrapped value when it is an error
object; `[]` for any other raised value.

---

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