Interface SqlExceptionMapper
- All Superinterfaces:
io.micronaut.core.order.Ordered
public interface SqlExceptionMapper
extends io.micronaut.core.order.Ordered
The
SQLException
mapper interface. Can be used to map given SQL exceptions to some custom exceptions
(for example DataAccessException
and its descendents like OptimisticLockException
).- Since:
- 4.8.0
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescription@NonNull Dialect
@Nullable DataAccessException
mapSqlException
(@NonNull SQLException sqlException) MapsSQLException
to customDataAccessException
.Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Method Details
-
getDialect
- Returns:
- the
Dialect
that this mapper supports
-
mapSqlException
@Nullable @Nullable DataAccessException mapSqlException(@NonNull @NonNull SQLException sqlException) MapsSQLException
to customDataAccessException
. In case when mapper is not able to mapSQLException
to customDataAccessException
then result will be null indicating that mapper cannot map the exception.- Parameters:
sqlException
- The SQL exception- Returns:
- mapped
DataAccessException
fromSQLException
or if mapper cannot mapSQLException
then returns null
-