AshNeo4j.Error.Neo4j exception (AshNeo4j v0.10.1)

Copy Markdown View Source

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.

Summary

Functions

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

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

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.

Functions

constraint_violation?(arg1)

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

exception(args)

@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(error)

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.