Handling Database Errors
3.3 · Lesson

Handling Database Errors

When working with Neo4j, you may encounter various database errors that need to be handled gracefully in your application. The driver exports a Neo4jError class that is inherited by all exceptions thrown by the database. Exceptions related to the driver and its connection are subclasses of DriverError.

  • CypherSyntaxError - Raised when the Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. syntax is invalid
  • ConstraintError - Raised when a Full definition for constraint (opens in a new tab)A rule the database enforces on every node or relationship with a given label or type, rejecting any write that breaks it. unique or other is violated
  • AuthError - Raised when authentication fails
  • TransientError - Raised when the database is not accessible