You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I debug the example below I see that wrap() swallows the exception even in the case that no rejection handlers are registered. This is not a good thing: consider that the function that throws here could be many libraries away and know nothing about Promises.
var testResult = (function () {
var p = new Promise(function(r) {
setTimeout(function() {
r.resolve();
}, 10);
});
p.then(function() {
throw new Error('blam');
});
return p;
})();
testResult.then(function(value) {
console.log("success");
}, function(error) {
console.error(error);
});
The text was updated successfully, but these errors were encountered:
testResult is certainly p. Something is rejected but I have no way to know if it is the return value of p.then().
That p.then() is an internally created Promise helps explain this bug from a naive dev's point of view: if the system is creating promises and I am not resolving them it can't be a good result.
When I debug the example below I see that wrap() swallows the exception even in the case that no rejection handlers are registered. This is not a good thing: consider that the function that throws here could be many libraries away and know nothing about Promises.
The text was updated successfully, but these errors were encountered: