Last active
September 25, 2019 15:20
-
-
Save deepal/3e24b2dd0f5f9bf360b3b02a6a1e3b55 to your computer and use it in GitHub Desktop.
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
// Example 1 | |
try { | |
return await myAsyncFunction(); | |
} catch (err) { | |
// Any promise rejection while calling myAsyncFunction() will reach here, because of using `await` | |
} | |
// Example 2 | |
try { | |
return myAsyncFunction(); | |
} catch (err) { | |
// No promise rejection will reach here because the promise is returned to the caller instead of | |
// resolving it here. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment