Module Neodriver_core.Errors

Error taxonomy (server and driver errors).

Error taxonomy for the Neo4j driver.

See errors.ml for the implementation.

type classification =
  1. | Client
  2. | Database
  3. | Transient
  4. | Unknown
    (*

    Classification of a server-reported error, derived from its code.

    *)
type server_error = {
  1. code : string;
  2. message : string;
  3. classification : classification;
  4. retryable : bool;
}

A server (Neo4j) error as reported over the wire.

type specific =
  1. | Constraint
  2. | Cypher_syntax
  3. | Cypher_type
  4. | Forbidden
  5. | Forbidden_on_read_only_database
  6. | Auth
  7. | Token_expired
  8. | Not_a_leader
  9. | Database_unavailable
  10. | Other
    (*

    Well-known server errors, recognised by their neo4j code.

    *)
type t =
  1. | Neo4j of server_error
  2. | Session_expired of string
  3. | Service_unavailable of string
  4. | Routing_service_unavailable of string
  5. | Write_service_unavailable of string
  6. | Read_service_unavailable of string
  7. | Incomplete_commit of string
  8. | Session_error of string
  9. | Transaction_error of string
  10. | Transaction_nesting_error of string
  11. | Result_failed_error of string
  12. | Result_consumed_error of string
  13. | Result_not_single_error of string
  14. | Broken_record_error of string
  15. | Configuration_error of string
  16. | Auth_configuration_error of string
  17. | Certificate_configuration_error of string
  18. | Unsupported_server_product of string
  19. | Connection_pool_error of string
  20. | Connection_acquisition_timeout of string
    (*

    Driver and server errors.

    *)
type failures = {
  1. last : t;
  2. all : t list;
}

All errors from a failed multi-address connection attempt: last is the most recent failure and all lists every failure in order of occurrence. The OCaml analogue of the Python driver's exception aggregation when no resolved address can be connected.

val is_retryable : t -> bool

Whether an error is safe to retry a transaction after.

val of_neo4j_code : code:string -> message:string -> t

Build a server error from a neo4j code and message, applying the classification and legacy re-write maps.

val code : t -> string option

The neo4j code of a server error, or None for driver errors.

val message : t -> string

The message of an error.

val classification : t -> classification option

The classification of a server error, or None for driver errors.

val specific : t -> specific

The well-known specific error kind, if any.

val unauthenticates_all_connections : t -> bool

Whether the error invalidates the authentication of all connections (AuthorizationExpired).

val has_security_code : t -> bool

Whether the error carries a Neo.ClientError.Security.* code.

val is_fatal_during_discovery : t -> bool

Whether the error should fail fast during routing discovery.

val to_string : t -> string

Render an error as a human-readable string.

val classification_to_string : classification -> string

Render a classification as its neo4j string ("ClientError", ...).

val specific_to_string : specific -> string

Render a specific error kind as a string.