fix: ensure to not force unhandled rejections

This commit is contained in:
Mariusz Nowak
2018-08-13 13:14:06 +02:00
parent 855c46077e
commit 9b416eafaa

View File

@@ -66,7 +66,9 @@ require("../lib/registered-extensions").promise = function (mode, conf) {
if (resolvedMode === "then") {
var nextTickFailure = function () { nextTick(onFailure); };
promise.then(function (result) {
// Eventual finally needs to be attached to non rejected promise
// (so we not force propagation of unhandled rejection)
promise = promise.then(function (result) {
nextTick(onSuccess.bind(this, result));
}, nextTickFailure);
// If `finally` is a function we attach to it to remove cancelled promises.