# `Tama.Dex.Error`
[🔗](https://github.com/kritama/tama-dex/blob/v0.1.0/lib/tama/dex/error.ex#L1)

An error produced by tama-dex during `Tama.Dex.execute/5`.

`dispatched` says whether the executor was called:

- `false`: the operation did not run. Kinds `:not_found`, `:not_ready`,
  `:no_executor`, `:invalid_input` and `:confirmation_required`.
- `true`: the operation may have taken effect, and must be reconciled
  rather than retried. Kinds `:dispatch_failed` and `:invalid_output`.

An executor's own valid error is not a `Tama.Dex.Error`. `execute/5`
returns it as `{:error, %{cassette, operation_id, source, operation_error}}`,
so match `%Tama.Dex.Error{}` first.

`message` is at most 256 bytes. `details` depends on the kind:

| Kind | Details |
|---|---|
| `:no_executor` | `%{source: source}` |
| `:invalid_input` | `%{issues: [%{pointer, message}], issues_truncated: boolean}` (at most 16 issues), or `%{}` when the input isn't a JSON object within 1 MiB |
| `:confirmation_required` | `%{field: field, description: description}` |
| `:dispatch_failed` | `%{exception_kind: :error \| :exit \| :throw}` |
| `:invalid_output` | `%{identity: %{name => value}}`, the declared `x-tama-identity` values found in the result |

Errors never carry input values or result content, apart from those
identity values.

# `kind`

```elixir
@type kind() ::
  :not_found
  | :not_ready
  | :no_executor
  | :invalid_input
  | :confirmation_required
  | :dispatch_failed
  | :invalid_output
```

# `t`

```elixir
@type t() :: %Tama.Dex.Error{
  details: map(),
  dispatched: boolean(),
  kind: kind(),
  message: String.t()
}
```

---

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