Created
December 16, 2017 22:17
-
-
Save MaxPleaner/61da71d1bc2e3f6e2ba32e65a63b5900 to your computer and use it in GitHub Desktop.
error bubbling with async/promise example
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
a = new Promise (resolve) -> | |
setTimeout resolve, 1000 | |
b = -> | |
c = await a | |
throw "error" | |
d = -> | |
e = await b() | |
d().catch (e) -> | |
console.log e | |
# (Prints "error") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment