class ExceptionHandler (View source)

Base Database exception handler class.

This class handles exceptions thrown by the database layer. Database driver implementation can provide an alternative implementation to support special handling required by that database.

Methods

void
handleStatementException(Exception $exception, string $sql, array $options = [])

Handles exceptions thrown during the preparation of statement objects.

void
handleExecutionException(Exception $exception, StatementInterface $statement, array $arguments = [], array $options = [])

Handles exceptions thrown during execution of statement objects.

Details

void handleStatementException(Exception $exception, string $sql, array $options = [])

Handles exceptions thrown during the preparation of statement objects.

Parameters

Exception $exception

The exception to be handled.

string $sql

The SQL statement that was requested to be prepared.

array $options

An associative array of options to control how the database operation is run.

Return Value

void

Exceptions

DatabaseExceptionWrapper

void handleExecutionException(Exception $exception, StatementInterface $statement, array $arguments = [], array $options = [])

Handles exceptions thrown during execution of statement objects.

Parameters

Exception $exception

The exception to be handled.

StatementInterface $statement

The statement object requested to be executed.

array $arguments

An array of arguments for the prepared statement.

array $options

An associative array of options to control how the database operation is run.

Return Value

void

Exceptions

DatabaseExceptionWrapper
IntegrityConstraintViolationException