Promise rejections don't resolve the argument

Fabrício Matté ultcombo at
Sun Dec 28 13:02:56 PST 2014

`Promise.resolve` and the Promise executor function's `resolve` argument
lets you "delegate" the fulfillment of the given promise to another promise
object. That is essential for composability.

In the other hand, `Promise.reject` and the Promise executor function's
`reject` argument are to be called at the point when the given operation
fails and you already have enough info to reject it with a `reason` (that
is, `reject` is similar to a `throw` when compared to non-async code). In
this context, it wouldn't make much sense to delegate the failing of a
promise, since reject is always called when you're 100% positive that the
operation has already failed. Just like `throw`, you can pass any object as
the `reason` argument to `reject()`, but good practices tell you to only
pass error objects.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list