Interface ExceptionTranslator

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ExceptionTranslator
This is a helper class modelled roughly after org.springframework.dao.support.PersistenceExceptionTranslator.
There are several situations where exceptions that happen inside a specific driver bubbles up into the core and cannot be caught inside the driver. This is especially true for the bolt driver: The org.neo4j.ogm.drivers.bolt.response.BoltResponse keeps an open result set which might throw a org.neo4j.driver.exceptions.ServiceUnavailableException at a very late stage.
This should be handled gracefully inside the org.neo4j.ogm.session.Neo4jSession. It uses this translator to translate driver specific exceptions into exception declared in the Neo4j-OGM api.
Since:
3.2
Author:
Michael J. Simons
  • Method Details

    • translateExceptionIfPossible

      RuntimeException translateExceptionIfPossible(Throwable e)
      Translates exceptions thrown by any of the drivers into exceptions defined in the Neo4j-OGM api. It has to deal with very generic throwables due to the way Neo4jSession has been modelled.
      Parameters:
      e - Exception to translate
      Returns:
      The translated exception or e itself if a translation is not possible.