/**
* @override
* @inheritDoc
*/
public function fail($ex, $params = [])
{
if ($this->failureHash !== null) {
return;
}
$super = $this->getSupervisor();
$loop = $this->getLoop();
$hash = HashSupport::hash();
$this->failureHash = $hash;
$params['hash'] = $hash;
$this->setLoopState(self::LOOP_STATE_FAILED);
$loop->onTick(function () use($super, $ex, $params) {
try {
$super->solve($ex, $params)->done(null, function ($reason) {
throw $reason;
});
} catch (Error $ex) {
$super->solve($ex);
} catch (Exception $ex) {
$super->solve($ex);
}
});
}