In addition to then()
, Q.js also has a done()
. done()
is usually called at the end of a promise chain, like this:
promise
.then(callback)
.then(callback)
.done(callback);
This will catch any rejections that were not handled by the previous then()
s, and it will handle any exceptions raised in then()
's callbacks.
Is there something similar in when.js? How do you handle exceptions raised in callbacks? And what if you never register a rejection handler?
It looks like
when
now has.done()
as well as.catch()
and.finally()
.See https://github.com/cujojs/when/blob/master/docs/api.md#extended-promise-api