# `AshLua.Error`
[🔗](https://github.com/ash-project/ash_lua/blob/v0.1.0/lib/ash_lua/error.ex#L5)

Protocol for rendering Ash errors into the Lua-side error shape.

Each `to_error/1` impl returns a map with these keys (all strings on the Lua side):

  * `:message` — the human-readable message to surface
  * `:short_message` — a terse variant suitable for tooltips/logs
  * `:code` — a stable, machine-readable identifier (e.g. `"invalid_argument"`, `"required"`, `"not_found"`)
  * `:fields` — list of atom field names this error relates to (may be empty)
  * `:vars` — additional template/context variables interpolatable into `message`

Errors without an impl fall through to an opaque "unknown error" entry in the encoder.

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `to_error`

```elixir
@spec to_error(term()) :: %{
  message: String.t(),
  short_message: String.t(),
  code: String.t(),
  fields: [atom()],
  vars: map()
}
```

---

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