Package org.mariadb.jdbc.internal.util.exceptions

## Class ExceptionMapper

- java.lang.Object
- - org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper

    public class ExceptionMapper
    extends Object

### Constructor Summary

Constructors
`ExceptionMapper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `checkConnectionException​(SQLException exception, MariaDbConnection connection)` Check connection exception to report to poolConnection listeners.
`static SQLException` `connException​(String message)`
`static SQLException` `connException​(String message, Throwable cause)`
`static SQLException` `get​(String message, String sqlState, int errorCode, Throwable exception, boolean timeout)` Helper to decorate exception with associate subclass of `SQLException` exception.
`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` `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

#### 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

#### connException

    public static SQLException connException​(String message)

#### connException

    public static SQLException connException​(String message,
                                             Throwable cause)

#### 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

#### checkConnectionException

    public static void checkConnectionException​(SQLException exception,
                                                MariaDbConnection connection)

Check connection exception to report to poolConnection listeners.

Parameters:
  `exception` - current exception
  `connection` - current connection

#### get

    public static SQLException get​(String message,
                                   String sqlState,
                                   int errorCode,
                                   Throwable exception,
                                   boolean timeout)

Helper to decorate exception with associate subclass of `SQLException` exception.

Parameters:
  `message` - exception message
  `sqlState` - sqlstate
  `errorCode` - errorCode
  `exception` - cause
  `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