Last active
August 29, 2015 14:05
-
-
Save bjoerge/2b856720b16a4d67e29b 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
// Can you spot the bug? You will never se any errors in devtools/console when running this. | |
new Promise(function(reslove) { | |
resolve("Foo"); | |
}) | |
.then(function() { | |
console.log("Why is this never called?"); | |
}); |
Two ways to 'do it right'...
1: not ideal, but functional...
new Promise(function(reslove) {
resolve("Foo");
})
.catch(function (e){ console.log(e); })
.then(function() {
console.log("Why is this never called?");
});
2: doing it right
new Promise(function(reslove) {
resolve("Foo");
})
.then(function() {
console.log("Why is this never called?");
}, function (e) { console.log(e); });
My point was that typos like this are (currently) swallowed silently and not being reported to devtools/console (at least in Chrome/FF).
Relevant: domenic/promises-unwrapping#19
Chromium issue: https://code.google.com/p/v8/issues/detail?id=3093
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have a typo...
reslove
vsresolve
.