If an error is thrown in the executor function, the promise is rejected.
Native promise
nodejs 7.10.0
Code
'use strict';
const p = new Promise(() => {
throw new Error('boom');
});
p.catch(err => console.log(`catch ${err}`));
Result
$ node t.js
catch Error: boom
vow.Promise
nodejs 7.10.0
vow 0.4.15
Code
'use strict';
const vow = require('vow');
const p = new vow.Promise(() => {
throw new Error('boom');
});
p.catch(err => console.log(`catch ${err}`));
Result
$ node t.js
/home/kostya/tmp/pg-test/t.js:6
throw new Error('boom');
^
Error: boom
at vow.Promise (/home/kostya/tmp/pg-test/t.js:6:11)
at Promise (/home/kostya/node_modules/vow/lib/vow.js:324:9)
at Object.<anonymous> (/home/kostya/tmp/pg-test/t.js:5:11)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
From MDN
Native promise
7.10.0
Code
Result
vow.Promise
7.10.0
0.4.15
Code
Result