Courageous Cuscus
Thanks to @benschulz, this patch release of Pacta fixes issues with chain
, chainError
and empty
.
Specifically, chain
and chainError
now encapsulate exceptions raised if the functions passed to them don't return a promise themselves (e.g. if they throw an exception):
var p = Promise.of(1).chain(function () {
throw new TypeError();
});
p.onRejected(function (r) {
// r will now contain the TypeError thrown above
});
empty
now works for unresolved promises as well as resolved ones:
var p = new Promise();
p.concat(p.empty()); // will no longer throw an error because p has no value
As ever, install the latest version via npm or Bower:
$ npm install pacta
$ bower install pacta