@FunctionalInterface public interface CqlExceptionTranslator extends PersistenceExceptionTranslator
DriverExceptios
and Spring's data access
strategy-agnostic DataAccessException
hierarchy.DataAccessException
,
2.0
Modifier and Type | Method and Description |
---|---|
default DataAccessException |
translate(String task,
String cql,
com.datastax.driver.core.exceptions.DriverException ex)
Translate the given
DriverException into a generic DataAccessException . |
translateExceptionIfPossible
default DataAccessException translate(@Nullable String task, @Nullable String cql, com.datastax.driver.core.exceptions.DriverException ex)
DriverException
into a generic DataAccessException
.
The returned DataAccessException
is supposed to contain the original DriverException
as root cause.
However, client code may not generally rely on this due to DataAccessException
s possibly being caused by
other resource APIs as well. That said, a getRootCause() instanceof DataAccessException
check (and
subsequent cast) is considered reliable when expecting Cassandra-based access to have happened.
task
- readable text describing the task being attempted.cql
- CQL query or update that caused the problem (may be null).ex
- the offending DriverException
.DriverException
.NestedRuntimeException.getRootCause()
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.