Skip to content

Instantly share code, notes, and snippets.

@paulswail
Created March 9, 2016 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulswail/842af71cbc5c42b075a8 to your computer and use it in GitHub Desktop.
Save paulswail/842af71cbc5c42b075a8 to your computer and use it in GitHub Desktop.
Promise rethrow inside catch
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