public function catchExceptions()
{
while (count($this->exceptionStorage) > 0) {
list($serverName, $exceptionClass, $message) = $this->exceptionStorage->pop();
// Print exception message.
$this->informer->taskException($serverName, $exceptionClass, $message);
// Save message.
$this->lastExceptionMessage = $message;
// We got some exception, so not.
$this->isSuccessfullyFinished = false;
if ($exceptionClass == 'Deployer\\Exception\\NonFatalException') {
// If we got NonFatalException, continue other tasks.
$this->hasNonFatalException = true;
} else {
// Do not run other task.
// Finish all current worker tasks and stop loop.
$this->tasks = [];
// Worker will not mark this task as done (remove self server name from `tasks_to_do` list),
// so to finish current task execution we need to manually remove it from that list.
$taskToDoStorage = $this->pure->getStorage('tasks_to_do');
$taskToDoStorage->delete($serverName);
}
}
}