Created
January 15, 2016 06:43
-
-
Save siemiatj/ce2a881e0672d531d474 to your computer and use it in GitHub Desktop.
Reject from promise is automatically treated as error in try/catch
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
function getFoo() { | |
return new Promise(function(resolve, reject) { | |
return reject(error); | |
}); | |
} | |
try { | |
var x = getFoo(); | |
} catch(error) { | |
console.error(error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment