1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00

error traceback improvement

This commit is contained in:
Daniel Lowrey 2015-06-16 11:10:53 -04:00
parent 40fbb6e16d
commit c7d0f3f86e

View File

@ -576,13 +576,13 @@ function __coroutineAdvance($cs) {
$cs->currentPromise = $yielded; $cs->currentPromise = $yielded;
$cs->reactor->immediately("Amp\__coroutineNextTick", ["cb_data" => $cs]); $cs->reactor->immediately("Amp\__coroutineNextTick", ["cb_data" => $cs]);
} else { } else {
$error = makeGeneratorError($cs->generator, sprintf( $error = new \DomainException(makeGeneratorError($cs->generator, sprintf(
'Unexpected yield (Promise|null|"return" expected); %s yielded at key %s', 'Unexpected yield (Promise|null|"return" expected); %s yielded at key %s',
is_object($yielded) ? get_class($yielded) : gettype($yielded), is_object($yielded) ? get_class($yielded) : gettype($yielded),
$key $key
)); )));
$cs->reactor->immediately(function() use ($cs, $error) { $cs->reactor->immediately(function() use ($cs, $error) {
$cs->promisor->fail(new \DomainException($error)); $cs->promisor->fail($error);
}); });
} }
} catch (\Exception $uncaught) { } catch (\Exception $uncaught) {