Last active
October 6, 2017 13:08
-
-
Save pomle/85ce7a4ee069010a357f48d30888191d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 fail() { | |
return new Promise((resolve, reject) => { | |
reject(new Error('This failed')); | |
}); | |
} | |
function doAction() { | |
return fail() | |
.catch(error => { | |
console.log('Arbitrarily chosen error logging the caller can not know about.'); | |
}); | |
} | |
doAction() | |
.then(result => { | |
// Will run | |
console.log('False positive success!'); | |
}) | |
.catch(error => { | |
// Will not run | |
console.error('An error happened but no one will ever now', error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment