Created
December 13, 2014 03:56
-
-
Save adamloving/e70fc132bc98ddbcade8 to your computer and use it in GitHub Desktop.
my first streamline experiment
This file contains 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
#!/usr/bin/env _coffee | |
console.log 'hello ...' | |
setTimeout _, 100 | |
console.log '... world' | |
doSomething = (isError, cb) -> | |
process.nextTick -> | |
if isError | |
cb(new Error('error'), isError) | |
else | |
cb(null, isError) | |
doSomething true, (err, output) -> | |
console.log('callback expect error:', err, output) | |
doSomething false, (err, output) -> | |
console.log('callback expect null:', err, output) | |
try | |
result1 = doSomething true, _ | |
catch e | |
console.log 'result1', result1 # undefined (never returned) | |
console.log 'CAUGHT ERROR', e.stack | |
result2 = doSomething false, _ | |
console.log 'result2', result2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment