Closed
Description
-
What version of bluebird is the issue happening on?
3.5.1 & branch associated with Fix Promise.map unhandled rejections (#1487) #1489 -
What platform and version? (For example Node.js 0.12 or Google Chrome 32)
$node --version
v6.11.0
- Did this issue happen with earlier version of bluebird?
Does not reproduce in3.5.0
Description of issue:
Reproduction here:
https://github.com/erikerikson/chai-bluebird/tree/bb-1489-use-test
Executing:
const BbPromise = require('bluebird');
process.on('unhandledRejection', err => {
console.log('###########################################################################');
console.log(`UNHANDLED! ${err}`);
console.log('###########################################################################');
});
BbPromise.reduce(
[
BbPromise.resolve('foo'),
BbPromise.reject(new Error('reason')),
BbPromise.resolve('bar')
],
() => {},
{}
)
.catch(() => console.log('caught'))
.then(() => console.log('after'))
Produces:
###########################################################################
UNHANDLED! Error: reason
###########################################################################
caught
after
Neither of the following produce this:
BbPromise.reduce(
[
BbPromise.resolve('foo'),
BbPromise.resolve('bar')
],
() => BbPromise.reject(new Error('reason')),
{}
)
.catch(() => console.log('caught'))
.then(() => console.log('after'))
BbPromise.reduce(
BbPromise.reject(new Error('reason')),
() => {},
{}
)
.catch(() => console.log('caught'))
.then(() => console.log('after'))