Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function ($error) use (&$exception, &$rejected, &$wait, $loop) {
if ($rejected) {
if (!$exception instanceof \Exception) {
$exception = new \UnexpectedValueException(
'Promise rejected with unexpected value of type ' . (is_object(($exception) ? get_class($exception) : gettype($exception))),
'Promise rejected with unexpected value of type ' . (is_object($exception) ? get_class($exception) : gettype($exception)),
0,
$exception instanceof \Throwable ? $exception : null
);
Expand Down
14 changes: 14 additions & 0 deletions tests/FunctionAwaitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ public function testAwaitOneRejectedWithFalseWillWrapInUnexpectedValueException(
Block\await($promise, $this->loop);
}

/**
* @expectedException UnexpectedValueException
*/
public function testAwaitOneRejectedWithNonFalsyWillWrapInUnexpectedValueException()
{
$all = array(
$this->createPromiseResolved(1),
Promise\reject(new Exception('first')),
Promise\reject(new Exception('second'))
);

Block\await(Promise\some($all, count($all)), $this->loop);
}

/**
* @expectedException UnexpectedValueException
*/
Expand Down