Last active
February 1, 2019 10:57
-
-
Save lon-io/f8594f0fb40a555549f3e94f2866dae5 to your computer and use it in GitHub Desktop.
Async Await Error handling
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
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