public function done(callable $onFulfilled = null, callable $onRejected = null)
{
$exception = $this->exception;
if (null !== $onRejected) {
try {
$onRejected($exception);
return;
} catch (Throwable $exception) {
// Code below will rethrow exception from loop.
}
}
Loop\queue(function () use($exception) {
throw $exception;
// Rethrow exception in uncatchable way.
});
}