Skip to content

Instantly share code, notes, and snippets.

@lon-io
Last active February 1, 2019 10:57
Show Gist options
  • Save lon-io/f8594f0fb40a555549f3e94f2866dae5 to your computer and use it in GitHub Desktop.
Save lon-io/f8594f0fb40a555549f3e94f2866dae5 to your computer and use it in GitHub Desktop.
Async Await Error handling
const a = (cb) => {
cb()
.then((res) => console.log(res))
.catch(error => {
console.log('Error caught', error.message)
})
}
const b = async() => {
throw new Error('new error')
}
const c = async() => {
return 'No Error'
}
a(b);
a(c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment