Skip to content

Courageous Cuscus

Compare
Choose a tag to compare
@mudge mudge released this 12 Mar 09:42
· 15 commits to master since this release
v0.5.1

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