Created
April 27, 2019 13:45
-
-
Save deepal/e5056d3de1cf411868558dad9dbb77af 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 myAsyncFunction() { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| reject(new Error('oops')) | |
| }, 1000); | |
| }) | |
| } | |
| myAsyncFunction() | |
| .then(() => { | |
| // happy path | |
| }) | |
| .catch((err) => { | |
| // handle error | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment