Promises: final steps

Domenic Denicola domenic at domenicdenicola.com
Thu Sep 5 09:04:29 PDT 2013


From: Kevin Smith [zenparsing at gmail.com]

> Indeed, for a non-GUI embedding like Node, they *must* be debuggable using just a console.

This is an important point. A provisional idea that preserves our desire to not introduce new features to promises themselves, requiring user choice at authoring time, might be some kind of `console.unhandledRejections()` function which returns you a snapshot of the current unhandled rejections bucket.

> Another option is a static method which takes a promise and throws rejections ala done:
>
> ```js
> Promise.throw(makeSomePromise.then(...));
> ```

I find these kind of things confusing. RSVP did something similar, introducing

```js
RSVP.rethrow = r => setImmediate(() => throw r);
```

so that you write

```js
somePromise.then(...).catch(RSVP.rethrow); // actually RSVP uses `fail`.
```

It's not clear to me why this, or your `Promise.throw`, is better than

```js
somePromise.done(...)
// or
somePromise.then(...).done()
```



More information about the es-discuss mailing list