function BatchTestCallbacks::callback8

Implements callback_batch_operation().

Performs a simple batch operation that optionally throws an exception.

File

core/modules/system/tests/modules/batch_test/src/BatchTestCallbacks.php, line 155

Class

BatchTestCallbacks
Batch callbacks for testing batches.

Namespace

Drupal\batch_test

Code

public function callback8(bool $throw_exception) : void {
    usleep(500);
    if ($throw_exception) {
        throw new \Exception('Exception in batch');
    }
}

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