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 Neo4jException class that is inherited by all exceptions thrown by the database.

  • AuthenticationException - Raised when authentication fails (incorrect credentials provided)
  • ClientException - Raised when the client-side error occurs
  • ConnectionReadTimeoutException - Raised when the connection to the database times out (Full definition for transaction (opens in a new tab)A unit of work that either succeeds in full or leaves no trace. took longer than timeout - 30 seconds, by default)
  • DatabaseException - Raised when there is a problem with the database
  • GqlStatusErrorClassification - Raises an error based on GQL status codes
  • RetryableException - Indicates retrying the transaction may succeed
  • ServiceUnavailableException - Raised when the database is unavailable (e.g., server is down or not running)
  • TransactionTerminatedException - Indicates that a transaction was terminated for some reason