ExceptionHandler.php

Same filename in this branch
  1. 11.x core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php
  2. 11.x core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ExceptionHandler.php
  3. 11.x core/lib/Drupal/Core/Database/ExceptionHandler.php
Same filename and directory in other branches
  1. 9 core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php
  2. 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/ExceptionHandler.php
  3. 9 core/lib/Drupal/Core/Database/Driver/mysql/ExceptionHandler.php
  4. 9 core/lib/Drupal/Core/Database/ExceptionHandler.php
  5. 10 core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php
  6. 10 core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ExceptionHandler.php
  7. 10 core/lib/Drupal/Core/Database/Driver/mysql/ExceptionHandler.php
  8. 10 core/lib/Drupal/Core/Database/ExceptionHandler.php

Namespace

Drupal\mysqli\Driver\Database\mysqli

File

core/modules/mysqli/src/Driver/Database/mysqli/ExceptionHandler.php

View source
<?php

declare (strict_types=1);
namespace Drupal\mysqli\Driver\Database\mysqli;

use Drupal\Core\Database\StatementInterface;
use Drupal\mysql\Driver\Database\mysql\ExceptionHandler as BaseMySqlExceptionHandler;

/**
 * MySQLi database exception handler class.
 */
class ExceptionHandler extends BaseMySqlExceptionHandler {
  
  /**
   * {@inheritdoc}
   */
  public function handleExecutionException(\Exception $exception, StatementInterface $statement, array $arguments = [], array $options = []) : void {
    // Close the client statement to release handles.
    if ($statement->hasClientStatement()) {
      $statement->getClientStatement()
        ->close();
    }
    if (!$exception instanceof \mysqli_sql_exception) {
      throw $exception;
    }
    $this->rethrowNormalizedException($exception, $exception->getSqlState(), $exception->getCode(), $statement->getQueryString(), $arguments);
  }

}

Classes

Title Deprecated Summary
ExceptionHandler MySQLi database exception handler class.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.