class ExceptionHandler extends ExceptionHandler (View source)

deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. The MySQL database driver has been moved to the mysql module.

MySql database exception handler class.

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