# `Arex.Error`
[🔗](https://github.com/m/exarcade/blob/v0.1.0/lib/arex/error.ex#L1)

Normalized error constructors used across Arex.

Public helpers return `{:error, error_map}` tuples where `error_map.kind` is
suitable for pattern matching and the remaining fields preserve debugging
context from the originating request.

The goal of this module is stability at the API boundary. Callers should be
able to branch on `error.kind` without parsing raw response payloads, while
still having access to the request metadata and any ArcadeDB-specific detail
that was available.

In practice this means:

- transport errors and ArcadeDB errors share one shape
- `kind` is the main field for pattern matching in application code
- request metadata stays attached for observability and debugging
- helper-level validation failures look the same as remote failures

Most application code will not call these constructors directly, but the
module is public so consumers can rely on the documented error shape and the
stable `kind` vocabulary.

# `request_meta`

```elixir
@type request_meta() :: %{method: atom() | nil, path: String.t() | nil}
```

Metadata about the request that produced the error.

# `t`

```elixir
@type t() :: %{
  kind: atom(),
  message: String.t(),
  status: integer() | nil,
  arcade_code: String.t() | nil,
  details: any(),
  body: map(),
  request: request_meta()
}
```

Normalized error map returned by Arex APIs.

`kind` is the field intended for pattern matching. The remaining fields carry
human-readable diagnostics and request context.

# `arcadedb`

Builds a normalized error map from an ArcadeDB failure response.

# `bad_opts`

Returns an error indicating that call options were invalid.

# `database_required`

Returns an error indicating that a database name was required but absent.

# `from_body`

Builds a normalized ArcadeDB error map from a response body.

Structured bodies contribute `error`, `detail`, and `exception` fields when
they are present. Plain bodies are wrapped into a minimal map so callers still
receive a consistent error shape.

# `invalid_identifier`

Returns an error indicating that an identifier failed validation.

# `multiple_results`

Returns an error indicating that a query or helper matched too many rows.

# `not_found`

Returns an error indicating that a requested entity was not found.

# `scope_without_tenant`

Returns an error indicating that scope cannot be used without tenant.

# `transaction_required`

Returns an error indicating that a transaction was required.

# `transport`

Builds an error map from a transport-layer exception.

# `type_required`

Returns an error indicating that a type name was required but absent.

---

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