Last active
May 18, 2019 06:27
-
-
Save tsq/7adc8ddfc86586371baba9dfb424e32e to your computer and use it in GitHub Desktop.
blog: 2019-05-18
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 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