public class ExceptionMapper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Set<java.lang.Integer> |
LOCK_DEADLOCK_ERROR_CODES |
Constructor and Description |
---|
ExceptionMapper() |
Modifier and Type | Method and Description |
---|---|
static void |
checkConnectionException(java.sql.SQLException exception,
MariaDbConnection connection)
Check connection exception to report to poolConnection listeners.
|
static java.sql.SQLException |
connException(java.lang.String message) |
static java.sql.SQLException |
connException(java.lang.String message,
java.lang.Throwable cause) |
static java.sql.SQLException |
get(java.lang.String message,
java.lang.String sqlState,
int errorCode,
java.lang.Throwable exception,
boolean timeout)
Helper to decorate exception with associate subclass of
SQLException exception. |
static java.sql.SQLException |
getException(java.sql.SQLException exception,
MariaDbConnection connection,
MariaDbStatement statement,
boolean timeout)
Helper to decorate exception with associate subclass of
SQLException exception. |
static java.sql.SQLException |
getFeatureNotSupportedException(java.lang.String message) |
static java.sql.SQLException |
getSqlException(java.lang.String message) |
static java.sql.SQLException |
getSqlException(java.lang.String message,
java.lang.Exception exception) |
static java.sql.SQLException |
getSqlException(java.lang.String message,
java.lang.String sqlState,
java.lang.Exception exception) |
static java.lang.String |
mapCodeToSqlState(int code)
Mapp code to State.
|
static void |
throwException(java.sql.SQLException exception,
MariaDbConnection connection,
MariaDbStatement statement)
Helper to throw exception.
|
private static final java.util.Set<java.lang.Integer> LOCK_DEADLOCK_ERROR_CODES
public static void throwException(java.sql.SQLException exception, MariaDbConnection connection, MariaDbStatement statement) throws java.sql.SQLException
exception
- exceptionconnection
- current connectionstatement
- current statementjava.sql.SQLException
- exceptionpublic static java.sql.SQLException connException(java.lang.String message)
public static java.sql.SQLException connException(java.lang.String message, java.lang.Throwable cause)
public static java.sql.SQLException getException(java.sql.SQLException exception, MariaDbConnection connection, MariaDbStatement statement, boolean timeout)
SQLException
exception.exception
- exceptionconnection
- current connectionstatement
- current statementtimeout
- was timeout on querypublic static void checkConnectionException(java.sql.SQLException exception, MariaDbConnection connection)
exception
- current exceptionconnection
- current connectionpublic static java.sql.SQLException get(java.lang.String message, java.lang.String sqlState, int errorCode, java.lang.Throwable exception, boolean timeout)
SQLException
exception.message
- exception messagesqlState
- sqlstateerrorCode
- errorCodeexception
- causetimeout
- was timeout on querypublic static java.sql.SQLException getSqlException(java.lang.String message, java.lang.Exception exception)
public static java.sql.SQLException getSqlException(java.lang.String message, java.lang.String sqlState, java.lang.Exception exception)
public static java.sql.SQLException getSqlException(java.lang.String message)
public static java.sql.SQLException getFeatureNotSupportedException(java.lang.String message)
public static java.lang.String mapCodeToSqlState(int code)
code
- code