function BatchStorage::catchException

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Batch/BatchStorage.php \Drupal\Core\Batch\BatchStorage::catchException()
  2. 8.9.x 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
BatchStorage::delete in core/lib/Drupal/Core/Batch/BatchStorage.php
BatchStorage::load in core/lib/Drupal/Core/Batch/BatchStorage.php
BatchStorage::update in core/lib/Drupal/Core/Batch/BatchStorage.php

File

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

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.