Skip to content

Instantly share code, notes, and snippets.

@tsq
Last active May 18, 2019 06:27
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 tsq/7adc8ddfc86586371baba9dfb424e32e to your computer and use it in GitHub Desktop.
Save tsq/7adc8ddfc86586371baba9dfb424e32e to your computer and use it in GitHub Desktop.
blog: 2019-05-18
function myApiFunc(callback) {
/**
* This pattern does NOT work!
*/
try {
doSomeAsynchronousOperation(err => {
if (err) {
throw (err);
}
/* continue as normal */
});
} catch (ex) {
callback(ex);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment