Class ExceptionMapper
- java.lang.Object
-
- org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper
-
public class ExceptionMapper extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<java.lang.Integer>LOCK_DEADLOCK_ERROR_CODES
-
Constructor Summary
Constructors Constructor Description ExceptionMapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckConnectionException(java.sql.SQLException exception, MariaDbConnection connection)Check connection exception to report to poolConnection listeners.static java.sql.SQLExceptionconnException(java.lang.String message)static java.sql.SQLExceptionconnException(java.lang.String message, java.lang.Throwable cause)static java.sql.SQLExceptionget(java.lang.String message, java.lang.String sqlState, int errorCode, java.lang.Throwable exception, boolean timeout)Helper to decorate exception with associate subclass ofSQLExceptionexception.static java.sql.SQLExceptiongetException(java.sql.SQLException exception, MariaDbConnection connection, MariaDbStatement statement, boolean timeout)Helper to decorate exception with associate subclass ofSQLExceptionexception.static java.sql.SQLExceptiongetFeatureNotSupportedException(java.lang.String message)static java.sql.SQLExceptiongetSqlException(java.lang.String message)static java.sql.SQLExceptiongetSqlException(java.lang.String message, java.lang.Exception exception)static java.sql.SQLExceptiongetSqlException(java.lang.String message, java.lang.String sqlState, java.lang.Exception exception)static java.lang.StringmapCodeToSqlState(int code)Mapp code to State.static voidthrowException(java.sql.SQLException exception, MariaDbConnection connection, MariaDbStatement statement)Helper to throw exception.
-
-
-
Method Detail
-
throwException
public static void throwException(java.sql.SQLException exception, MariaDbConnection connection, MariaDbStatement statement) throws java.sql.SQLExceptionHelper to throw exception.- Parameters:
exception- exceptionconnection- current connectionstatement- current statement- Throws:
java.sql.SQLException- exception
-
connException
public static java.sql.SQLException connException(java.lang.String message)
-
connException
public static java.sql.SQLException connException(java.lang.String message, java.lang.Throwable cause)
-
getException
public static java.sql.SQLException getException(java.sql.SQLException exception, MariaDbConnection connection, MariaDbStatement statement, boolean timeout)Helper to decorate exception with associate subclass ofSQLExceptionexception.- Parameters:
exception- exceptionconnection- current connectionstatement- current statementtimeout- was timeout on query- Returns:
- SQLException exception
-
checkConnectionException
public static void checkConnectionException(java.sql.SQLException exception, MariaDbConnection connection)Check connection exception to report to poolConnection listeners.- Parameters:
exception- current exceptionconnection- current connection
-
get
public 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 ofSQLExceptionexception.- Parameters:
message- exception messagesqlState- sqlstateerrorCode- errorCodeexception- causetimeout- was timeout on query- Returns:
- SQLException exception
-
getSqlException
public static java.sql.SQLException getSqlException(java.lang.String message, java.lang.Exception exception)
-
getSqlException
public static java.sql.SQLException getSqlException(java.lang.String message, java.lang.String sqlState, java.lang.Exception exception)
-
getSqlException
public static java.sql.SQLException getSqlException(java.lang.String message)
-
getFeatureNotSupportedException
public static java.sql.SQLException getFeatureNotSupportedException(java.lang.String message)
-
mapCodeToSqlState
public static java.lang.String mapCodeToSqlState(int code)
Mapp code to State.- Parameters:
code- code- Returns:
- String
-
-