Created
March 9, 2016 10:50
-
-
Save paulswail/842af71cbc5c42b075a8 to your computer and use it in GitHub Desktop.
Promise rethrow inside 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 rethrowTest() { | |
Promise.resolve(true).then(function() { | |
return new Promise(function(resolve, reject) { | |
reject(new Error('BOOM!')); | |
}).catch(function(err) { | |
console.error('First catch: ' + err); | |
throw err; | |
}); | |
}).then(function() { | |
console.log('I should not be printed'); | |
}).catch(function(err) { | |
console.error('Catch-all: ' + err); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment