ConnectionFactoryUtils.convertR2dbcException(String, String, R2dbcException)
instead.@FunctionalInterface @Deprecated public interface R2dbcExceptionTranslator
R2dbcExceptions
and Spring's data
access strategy-agnostic DataAccessException
hierarchy.
Implementations can be generic (for example, using SQLState
codes
for R2DBC) or wholly proprietary (for example, using Oracle error codes) for greater precision.
DataAccessException
,
SqlStateR2dbcExceptionTranslator
,
SqlErrorCodeR2dbcExceptionTranslator
Modifier and Type | Method and Description |
---|---|
DataAccessException |
translate(String task,
String sql,
R2dbcException ex)
Deprecated.
Translate the given
R2dbcException into a generic DataAccessException . |
@Nullable DataAccessException translate(String task, @Nullable String sql, R2dbcException ex)
R2dbcException
into a generic DataAccessException
.
The returned DataAccessException is supposed to contain the original R2dbcException
as root cause. However,
client code may not generally rely on this due to DataAccessExceptions possibly being caused by other resource APIs
as well. That said, a getRootCause() instanceof R2dbcException
check (and subsequent cast) is considered
reliable when expecting R2DBC-based access to have happened.
task
- readable text describing the task being attempted.sql
- SQL query or update that caused the problem (if known).ex
- the offending R2dbcException
.R2dbcException
, or null if no translation could be
applied (in a custom translator; the default translators always throw an
UncategorizedR2dbcException
in such a case).NestedRuntimeException.getRootCause()
Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.