function DatabaseBackend::catchException

Same name in this branch
  1. 9 core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::catchException()
Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::catchException()
  2. 8.9.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::catchException()
  3. 10 core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::catchException()
  4. 10 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::catchException()
  5. 11.x core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::catchException()
  6. 11.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::catchException()

Act on an exception when cache might be stale.

If the table does not yet exist, that's fine, but if the table exists and yet the query failed, then the cache is stale and the exception needs to propagate.

Parameters

$e: The exception.

string|null $table_name: The table name. Defaults to $this->bin.

Throws

\Exception

5 calls to DatabaseBackend::catchException()
DatabaseBackend::deleteAll in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Deletes all cache items in a bin.
DatabaseBackend::deleteMultiple in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Deletes multiple items from the cache.
DatabaseBackend::invalidateAll in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Marks all cache items as invalid.
DatabaseBackend::invalidateMultiple in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Marks cache items as invalid.
DatabaseBackend::removeBin in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Remove a cache bin.

File

core/lib/Drupal/Core/Cache/DatabaseBackend.php, line 443

Class

DatabaseBackend
Defines a default cache implementation.

Namespace

Drupal\Core\Cache

Code

protected function catchException(\Exception $e, $table_name = NULL) {
    if ($this->connection
        ->schema()
        ->tableExists($table_name ?: $this->bin)) {
        throw $e;
    }
}

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