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 DataAccessException
translate
(String task, String cql, RuntimeException ex) Translate the givenRuntimeException
into 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 givenRuntimeException
into a genericDataAccessException
.The returned
DataAccessException
is supposed to contain the originalDriverException
as root cause. However, client code may not generally rely on this due toDataAccessException
s possibly being caused by other resource APIs as well. That said, agetRootCause() instanceof DataAccessException
check (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:
-