function DatabaseQueue::catchException

Same name in other branches
  1. 9 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::catchException()
  2. 8.9.x core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::catchException()
  3. 10 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::catchException()

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

Parameters

$e: The exception.

Throws

\Exception If the table exists the exception passed in is rethrown.

9 calls to DatabaseQueue::catchException()
Batch::claimItem in core/lib/Drupal/Core/Queue/Batch.php
Overrides \Drupal\Core\Queue\DatabaseQueue::claimItem().
Batch::getAllItems in core/lib/Drupal/Core/Queue/Batch.php
Retrieves all remaining items in the queue.
DatabaseQueue::claimItem in core/lib/Drupal/Core/Queue/DatabaseQueue.php
Claims an item in the queue for processing.
DatabaseQueue::delayItem in core/lib/Drupal/Core/Queue/DatabaseQueue.php
Delay an item so it runs in the future.
DatabaseQueue::deleteItem in core/lib/Drupal/Core/Queue/DatabaseQueue.php
Deletes a finished item from the queue.

... See full list

File

core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 297

Class

DatabaseQueue
Default queue implementation.

Namespace

Drupal\Core\Queue

Code

protected function catchException(\Exception $e) {
    if ($this->connection
        ->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.