Created
June 17, 2015 19:06
-
-
Save ProTip/2d051e491ed90ba0fbab to your computer and use it in GitHub Desktop.
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
Promise = require "bluebird" | |
async = Promise.coroutine | |
AsyncError = async -> | |
throw new Error "AThrower exceptinon." | |
yield return | |
NestedAsyncError = async -> | |
yield do async -> | |
throw new Error "NestedAsync exception" | |
NestedPromiseThrower = async -> | |
yield do -> | |
new Promise (res, rej) -> | |
throw new Error "NestedPromise exception." | |
PromiseThrower = -> | |
new Promise (res, rej) -> | |
throw new Error "Promise error." | |
TryIt = async -> | |
try | |
#yield AsyncThrower() | |
#yield NestedAsyncThrower() | |
#yield NestedPromiseThrower() | |
yield PromiseThrower() | |
catch e | |
console.log "Caught something! #{e}" | |
yield return | |
TryIt() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment