Package org.mariadb.jdbc.export

## Class ExceptionFactory

- java.lang.Object
- - org.mariadb.jdbc.export.ExceptionFactory

Direct Known Subclasses:
  `ExceptionFactory.SqlExceptionFactory`

    public class ExceptionFactory
    extends Object

Exception factory. This permit common error logging, with thread id, dump query, and specific dead-lock additional information

### Nested Class Summary

Nested Classes
`class` `ExceptionFactory.SqlExceptionFactory` Exception with SQL command

### Constructor Summary

Constructors
`ExceptionFactory​(Configuration conf, HostAddress hostAddress)` Connection Exception factory constructor

### Method Summary

All Methods Instance Methods Concrete Methods
`SQLException` `create​(String message)` Creation of an exception
`SQLException` `create​(String message, String sqlState)` Creation of an exception
`SQLException` `create​(String message, String sqlState, int errorCode)` Creation of an exception
`SQLException` `create​(String message, String sqlState, Exception cause)` Creation of an exception
`BatchUpdateException` `createBatchUpdate​(List<org.mariadb.jdbc.client.Completion> res, int length, int[] responseMsg, SQLException sqle)` Create a BatchUpdateException, filling successful updates
`BatchUpdateException` `createBatchUpdate​(List<org.mariadb.jdbc.client.Completion> res, int length, SQLException sqle)` Create a BatchUpdateException, filling successful updates
`String` `getSql()` get SQL command
`SQLException` `notSupported​(String message)` fast creation of SQLFeatureNotSupportedException exception
`ExceptionFactory` `of​(Statement statement)` Construct an Exception factory from this + adding current statement
`ExceptionFactory` `setConnection​(Connection connection)` Set connection to factory
`void` `setConnection​(ExceptionFactory oldExceptionFactory)` Set connection
`ExceptionFactory` `setPoolConnection​(MariaDbPoolConnection internalPoolConnection)` Set pool connection to factory
`void` `setThreadId​(long threadId)` Set connection thread id
`ExceptionFactory` `withSql​(String sql)` Construct an Exception factory from this + adding current SQL

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ExceptionFactory

    public ExceptionFactory​(Configuration conf,
                            HostAddress hostAddress)

Connection Exception factory constructor

Parameters:
  `conf` - configuration
  `hostAddress` - current host

### Method Detail

#### setConnection

    public void setConnection​(ExceptionFactory oldExceptionFactory)

Set connection

Parameters:
  `oldExceptionFactory` - previous connection exception factory

#### setConnection

    public ExceptionFactory setConnection​(Connection connection)

Set connection to factory

Parameters:
  `connection` - connection
Returns:
  this `ExceptionFactory`

#### setPoolConnection

    public ExceptionFactory setPoolConnection​(MariaDbPoolConnection internalPoolConnection)

Set pool connection to factory

Parameters:
  `internalPoolConnection` - internal pool connection
Returns:
  this `ExceptionFactory`

#### setThreadId

    public void setThreadId​(long threadId)

Set connection thread id

Parameters:
  `threadId` - connection thread id

#### createBatchUpdate

    public BatchUpdateException createBatchUpdate​(List<org.mariadb.jdbc.client.Completion> res,
                                                  int length,
                                                  SQLException sqle)

Create a BatchUpdateException, filling successful updates

Parameters:
  `res` - completion list
  `length` - expected size
  `sqle` - exception
Returns:
  BatchUpdateException object

#### createBatchUpdate

    public BatchUpdateException createBatchUpdate​(List<org.mariadb.jdbc.client.Completion> res,
                                                  int length,
                                                  int[] responseMsg,
                                                  SQLException sqle)

Create a BatchUpdateException, filling successful updates

Parameters:
  `res` - completion list
  `length` - expected length
  `responseMsg` - successful response
  `sqle` - exception
Returns:
  BatchUpdateException object

#### of

    public ExceptionFactory of​(Statement statement)

Construct an Exception factory from this + adding current statement

Parameters:
  `statement` - current statement
Returns:
  new Exception factory

#### withSql

    public ExceptionFactory withSql​(String sql)

Construct an Exception factory from this + adding current SQL

Parameters:
  `sql` - current sql command
Returns:
  new Exception factory

#### notSupported

    public SQLException notSupported​(String message)

fast creation of SQLFeatureNotSupportedException exception

Parameters:
  `message` - error message
Returns:
  exception to be thrown

#### create

    public SQLException create​(String message)

Creation of an exception

Parameters:
  `message` - error message
Returns:
  exception to be thrown

#### create

    public SQLException create​(String message,
                               String sqlState)

Creation of an exception

Parameters:
  `message` - error message
  `sqlState` - sql state
Returns:
  exception to be thrown

#### create

    public SQLException create​(String message,
                               String sqlState,
                               Exception cause)

Creation of an exception

Parameters:
  `message` - error message
  `sqlState` - sql state
  `cause` - initial exception
Returns:
  exception to be thrown

#### create

    public SQLException create​(String message,
                               String sqlState,
                               int errorCode)

Creation of an exception

Parameters:
  `message` - error message
  `sqlState` - sql state
  `errorCode` - error code
Returns:
  exception to be thrown

#### getSql

    public String getSql()

get SQL command

Returns:
  sql command