org.mariadb.jdbc.internal.util.exceptions
Class ExceptionMapper

java.lang.Object
  extended by org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper

public class ExceptionMapper
extends Object


Constructor Summary
ExceptionMapper()
           
 
Method Summary
static SQLException getException(SQLException exception, MariaDbConnection connection, MariaDbStatement statement, boolean timeout)
          Helper to decorate exception with associate subclass of SQLException exception.
static SQLException getFeatureNotSupportedException(String message)
           
static SQLException getSqlException(String message)
           
static SQLException getSqlException(String message, Exception exception)
           
static SQLException getSqlException(String message, String sqlState, Exception exception)
           
static String mapCodeToSqlState(int code)
          Mapp code to State.
static void throwAndLogException(SQLException exception, MariaDbConnection connection, MariaDbStatement statement, Logger logger, boolean timeout)
          Helper to throw exception.
static void throwException(SQLException exception, MariaDbConnection connection, MariaDbStatement statement)
          Helper to throw exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionMapper

public ExceptionMapper()
Method Detail

throwAndLogException

public static void throwAndLogException(SQLException exception,
                                        MariaDbConnection connection,
                                        MariaDbStatement statement,
                                        Logger logger,
                                        boolean timeout)
                                 throws SQLException
Helper to throw exception. Exception is logged.

Parameters:
exception - exception
connection - current connection
statement - current statement
logger - logger
timeout - was timeout on query
Throws:
SQLException - exception

throwException

public static void throwException(SQLException exception,
                                  MariaDbConnection connection,
                                  MariaDbStatement statement)
                           throws SQLException
Helper to throw exception.

Parameters:
exception - exception
connection - current connection
statement - current statement
Throws:
SQLException - exception

getException

public static SQLException getException(SQLException exception,
                                        MariaDbConnection connection,
                                        MariaDbStatement statement,
                                        boolean timeout)
Helper to decorate exception with associate subclass of SQLException exception.

Parameters:
exception - exception
connection - current connection
statement - current statement
timeout - was timeout on query
Returns:
SQLException exception

getSqlException

public static SQLException getSqlException(String message,
                                           Exception exception)

getSqlException

public static SQLException getSqlException(String message,
                                           String sqlState,
                                           Exception exception)

getSqlException

public static SQLException getSqlException(String message)

getFeatureNotSupportedException

public static SQLException getFeatureNotSupportedException(String message)

mapCodeToSqlState

public static String mapCodeToSqlState(int code)
Mapp code to State.

Parameters:
code - code
Returns:
String


Copyright © 2017. All rights reserved.