# `AshNeo4j.Error.Neo4j`
[🔗](https://github.com/diffo-dev/ash_neo4j/blob/v0.10.1/lib/error.ex#L237)

Wraps a Neo4j server error surfaced from `AshNeo4j.Cypher.run/1` (a
`%Bolty.Error{}`), preserving its Neo4j status code and message and classifying
it by `:category` (#358) — so a failure surfaces as the actual error, not a
generic string. The server-side complement to the returned-error work (#350).

`:category` is one of `:constraint` (a `ConstraintValidationFailed` — what
`identities` / primary-key constraints rely on), `:transient` (retryable, e.g.
a deadlock), `:statement` (a syntax/parameter error — our generated Cypher is
wrong), `:security`, or `:other`.

# `constraint_violation?`

True for a Neo4j constraint-violation error (drives `identities` / PK constraints).

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %AshNeo4j.Error.Neo4j{
  __exception__: term(),
  bread_crumbs: term(),
  category: term(),
  class: term(),
  neo4j_code: term(),
  neo4j_message: term(),
  path: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}
```

Create an `Elixir.AshNeo4j.Error.Neo4j` without raising it.

## Keys

- :neo4j_code
- :neo4j_message
- :category

# `from_bolt`

Maps an error surfaced from `Cypher.run/1` to a classified `AshNeo4j.Error.Neo4j`.
A `%Bolty.Error{}` with a Neo4j status code is classified by that code; any
other error term is wrapped with `category: :other`.

---

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