Skip to content

Commit 8573049

Browse files
committed
Fix rejection forwarding example
1 parent fea160d commit 8573049

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,21 +381,21 @@ $deferred = new React\Promise\Deferred();
381381

382382
$deferred->promise()
383383
->then(function ($x) {
384-
throw $x + 1;
384+
throw new \Exception($x + 1);
385385
})
386-
->then(null, function ($x) {
386+
->then(null, function (\Exception $x) {
387387
// Propagate the rejection
388-
throw new \Exception($x + 1);
388+
throw $x;
389389
})
390390
->then(null, function (\Exception $x) {
391391
// Can also propagate by returning another rejection
392392
return React\Promise\When::reject((integer) $x->getMessage() + 1);
393393
})
394394
->then(null, function ($x) {
395-
echo 'Reject ' . $x; // 4
395+
echo 'Reject ' . $x; // 3
396396
});
397397

398-
$deferred->resolve(1); // Prints "Reject 4"
398+
$deferred->resolve(1); // Prints "Reject 3"
399399
```
400400

401401
#### Mixed resolution and rejection forwarding

0 commit comments

Comments
 (0)