Last active
August 29, 2015 14:27
-
-
Save pehlert/d6541bf0681d640cfeaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The promise "inner" should reject due to the ReferenceError that is inevitably thrown in line 13. | |
* There is no reject handler for "inner", because it is called as part of another promise chain "outer". | |
* However, the "outer" promise is being *resolved* and inner's rejection remains unhandled. | |
* To make this more weird, if in line 16 instead of "inner", "Promise.reject()" is returned, | |
* the outer promise will be rejected just fine. | |
*/ | |
var inner = Promise.resolve(), | |
outer = Promise.resolve(); | |
inner.then(function() { | |
return thisNameDoesNotExist; | |
}); | |
outer.then(function() { return inner; }) | |
.then(function() { console.log("resolved"); }, function(e) { console.log("rejected", e); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment