protected static function BatchProcessor::handleException in Automatic Updates 8.2
Records messages from a throwable, then re-throws it.
Parameters
\Throwable $error: The caught exception.
array $context: The current context of the batch job.
Throws
\Throwable The caught exception, which will always be re-thrown once its messages have been recorded.
4 calls to BatchProcessor::handleException()
- BatchProcessor::begin in src/
BatchProcessor.php - Calls the updater's begin() method.
- BatchProcessor::clean in src/
BatchProcessor.php - Calls the updater's clean() method.
- BatchProcessor::commit in src/
BatchProcessor.php - Calls the updater's commit() method.
- BatchProcessor::stage in src/
BatchProcessor.php - Calls the updater's stageVersions() method.
File
- src/
BatchProcessor.php, line 36
Class
- BatchProcessor
- A batch processor for updates.
Namespace
Drupal\automatic_updatesCode
protected static function handleException(\Throwable $error, array &$context) : void {
$error_messages = [
$error
->getMessage(),
];
if ($error instanceof UpdateException) {
foreach ($error
->getValidationResults() as $result) {
$messages = $result
->getMessages();
if (count($messages) > 1) {
array_unshift($messages, $result
->getSummary());
}
$error_messages = array_merge($error_messages, $messages);
}
}
foreach ($error_messages as $error_message) {
$context['results']['errors'][] = $error_message;
}
throw $error;
}