Skip to content

Instantly share code, notes, and snippets.

@zemuldo
Created June 22, 2019 22:50
Show Gist options
  • Select an option

  • Save zemuldo/2ce5857836ca6b1b466c01ff463045c1 to your computer and use it in GitHub Desktop.

Select an option

Save zemuldo/2ce5857836ca6b1b466c01ff463045c1 to your computer and use it in GitHub Desktop.
Handle errors in async await
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