Interface CqlExceptionTranslator
- All Superinterfaces:
PersistenceExceptionTranslator
- All Known Implementing Classes:
CassandraExceptionTranslator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy interface for translating between
driver exceptions and Spring's data access
strategy-agnostic DataAccessException hierarchy.- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault DataAccessExceptiontranslate(String task, String cql, RuntimeException ex) Translate the givenRuntimeExceptioninto a genericDataAccessException.Methods inherited from interface org.springframework.dao.support.PersistenceExceptionTranslator
translateExceptionIfPossible
-
Method Details
-
translate
default DataAccessException translate(@Nullable String task, @Nullable String cql, RuntimeException ex) Translate the givenRuntimeExceptioninto a genericDataAccessException.The returned
DataAccessExceptionis supposed to contain the originalDriverExceptionas root cause. However, client code may not generally rely on this due toDataAccessExceptions possibly being caused by other resource APIs as well. That said, agetRootCause() instanceof DataAccessExceptioncheck (and subsequent cast) is considered reliable when expecting Cassandra-based access to have happened.- Parameters:
task- readable text describing the task being attempted.cql- CQL query or update that caused the problem (may be null).ex- the offendingDriverException.- Returns:
- the DataAccessException, wrapping the
RuntimeException. - See Also:
-