Created
June 22, 2019 22:50
-
-
Save zemuldo/2ce5857836ca6b1b466c01ff463045c1 to your computer and use it in GitHub Desktop.
Handle errors in async await
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
| async function run_handle_errors() { | |
| try { | |
| await i_am_first_but_i_take_10_sec() | |
| await i_am_second_but_i_take_8_sec() | |
| await i_am_third_but_i_take_6_sec() | |
| await i_am_fourth_but_i_take_4_sec() | |
| await i_am_last_but_i_take_1_sec() | |
| console.log("Done") | |
| } catch (error) { | |
| console.log(error) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment