Skip to content

Commit

Permalink
Handle exceptions thrown by getting x.then.
Browse files Browse the repository at this point in the history
The strategy is to reject `promise` with the thrown exception as the reason. Fixes #87, fixes #88.
  • Loading branch information
domenic committed Mar 21, 2013
1 parent d08e9dd commit b468e50
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ To run `Resolve(promise, x)`, perform the following steps:
1. If/when `x` is rejected, reject `promise` with the same reason.
1. Otherwise, if `x` is an object or function,
1. Let `then` be `x.then`. [[4.5](#notes)]
1. If retrieving the property `x.then` results in a thrown exception `e`, reject `promise` with `e` as the reason.
1. If `then` is a function, call it with `x` as `this`, first argument `resolvePromise`, and second argument `rejectPromise`, where:
1. If/when `resolvePromise` is called with a value `y`, run `Resolve(promise, y)`.
1. If/when `rejectPromise` is called with a reason `r`, reject `promise` with `r`.
Expand Down

0 comments on commit b468e50

Please sign in to comment.