Skip to content

Instantly share code, notes, and snippets.

@MaxPleaner
Created December 16, 2017 22:17
Show Gist options
  • Save MaxPleaner/61da71d1bc2e3f6e2ba32e65a63b5900 to your computer and use it in GitHub Desktop.
Save MaxPleaner/61da71d1bc2e3f6e2ba32e65a63b5900 to your computer and use it in GitHub Desktop.
error bubbling with async/promise example
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