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 DataAccessExceptionmapSqlException(@NonNull SQLException sqlException) MapsSQLExceptionto customDataAccessException.Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Method Details
-
getDialect
- Returns:
- the
Dialectthat this mapper supports
-
mapSqlException
@Nullable @Nullable DataAccessException mapSqlException(@NonNull @NonNull SQLException sqlException) MapsSQLExceptionto customDataAccessException. In case when mapper is not able to mapSQLExceptionto customDataAccessExceptionthen result will be null indicating that mapper cannot map the exception.- Parameters:
sqlException- The SQL exception- Returns:
- mapped
DataAccessExceptionfromSQLExceptionor if mapper cannot mapSQLExceptionthen returns null
-