function DatabaseStorage::catchException
Same name in other branches
- 9 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::catchException()
- 11.x core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::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 if it is not a DatabaseException. Due to race conditions it is possible that another request has created the table in the meantime. Therefore we can not rethrow for any database exception.
Parameters
\Exception $e: The exception.
Throws
\Exception
8 calls to DatabaseStorage::catchException()
- DatabaseStorage::deleteAll in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Deletes all items from the key/value store.
- DatabaseStorage::deleteMultiple in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Deletes multiple items from the key/value store.
- DatabaseStorage::getAll in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Returns all stored key/value pairs in the collection.
- DatabaseStorage::has in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Returns whether a given key exists in the store.
- DatabaseStorage::rename in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Renames a key.
File
-
core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php, line 284
Class
- DatabaseStorage
- Defines a default key/value store implementation.
Namespace
Drupal\Core\KeyValueStoreCode
protected function catchException(\Exception $e) {
if (!$e instanceof DatabaseException && $this->connection
->schema()
->tableExists($this->table)) {
throw $e;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.