function BatchTestCallbacks::callback8

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/batch_test/src/BatchTestCallbacks.php \Drupal\batch_test\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 123

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.