function KeyValueDatabaseExpirableFactory::catchException

Same name in other branches
  1. 9 core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory::catchException()
  2. 11.x core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory::catchException()

Act on an exception when the table might not have been created.

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

Parameters

\Exception $e: The exception.

Throws

\Exception

1 call to KeyValueDatabaseExpirableFactory::catchException()
KeyValueDatabaseExpirableFactory::garbageCollection in core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php
Deletes expired items.

File

core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php, line 93

Class

KeyValueDatabaseExpirableFactory
Defines the key/value store factory for the database backend.

Namespace

Drupal\Core\KeyValueStore

Code

protected function catchException(\Exception $e) {
    if ($this->connection
        ->schema()
        ->tableExists('key_value_expire')) {
        throw $e;
    }
}

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