function DatabaseLockBackend::catchException

Same name in other branches
  1. 9 core/lib/Drupal/Core/Lock/DatabaseLockBackend.php \Drupal\Core\Lock\DatabaseLockBackend::catchException()
  2. 8.9.x core/lib/Drupal/Core/Lock/DatabaseLockBackend.php \Drupal\Core\Lock\DatabaseLockBackend::catchException()
  3. 11.x core/lib/Drupal/Core/Lock/DatabaseLockBackend.php \Drupal\Core\Lock\DatabaseLockBackend::catchException()

Act on an exception when semaphore 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 semaphore is stale and the exception needs to propagate.

Parameters

$e: The exception.

Throws

\Exception

2 calls to DatabaseLockBackend::catchException()
DatabaseLockBackend::lockMayBeAvailable in core/lib/Drupal/Core/Lock/DatabaseLockBackend.php
Checks if a lock is available for acquiring.
DatabaseLockBackend::release in core/lib/Drupal/Core/Lock/DatabaseLockBackend.php
Releases the given lock.

File

core/lib/Drupal/Core/Lock/DatabaseLockBackend.php, line 206

Class

DatabaseLockBackend
Defines the database lock backend. This is the default backend in Drupal.

Namespace

Drupal\Core\Lock

Code

protected function catchException(\Exception $e) {
    if ($this->database
        ->schema()
        ->tableExists(static::TABLE_NAME)) {
        throw $e;
    }
}

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