function BatchStorage::catchException

Same name in other branches
  1. 9 core/lib/Drupal/Core/Batch/BatchStorage.php \Drupal\Core\Batch\BatchStorage::catchException()
  2. 10 core/lib/Drupal/Core/Batch/BatchStorage.php \Drupal\Core\Batch\BatchStorage::catchException()
  3. 11.x core/lib/Drupal/Core/Batch/BatchStorage.php \Drupal\Core\Batch\BatchStorage::catchException()

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

Parameters

$e: The exception.

Throws

\Exception

4 calls to BatchStorage::catchException()
BatchStorage::cleanup in core/lib/Drupal/Core/Batch/BatchStorage.php
Cleans up failed or old batches.
BatchStorage::delete in core/lib/Drupal/Core/Batch/BatchStorage.php
Deletes a batch.
BatchStorage::load in core/lib/Drupal/Core/Batch/BatchStorage.php
Loads a batch.
BatchStorage::update in core/lib/Drupal/Core/Batch/BatchStorage.php
Updates a batch.

File

core/lib/Drupal/Core/Batch/BatchStorage.php, line 195

Class

BatchStorage

Namespace

Drupal\Core\Batch

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.