Skip to content

Commit 4edbe57

Browse files
committed
Fixing non-Promise thenables rejection
1 parent c935402 commit 4edbe57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

manuscript/11-Promises.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ p1.then(function(value) {
367367

368368
In this example, `Promise.resolve()` calls `thenable.then()` so that a promise state can be determined. The promise state for `thenable` is fulfilled because `resolve(42)` is called inside the `then()` method. A new promise called `p1` is created in the fulfilled state with the value passed from `thenable` (that is, 42), and the fulfillment handler for `p1` receives 42 as the value.
369369

370-
The same process can be used with `Promise.reject()` to create a rejected promise from a thenable:
370+
The same process can be used to create a rejected promise from a thenable:
371371

372372
```js
373373
let thenable = {
@@ -376,7 +376,7 @@ let thenable = {
376376
}
377377
};
378378

379-
let p1 = Promise.reject(thenable);
379+
let p1 = Promise.resolve(thenable);
380380
p1.catch(function(value) {
381381
console.log(value); // 42
382382
});

0 commit comments

Comments
 (0)