Last active
December 10, 2015 23:19
-
-
Save layerssss/4508752 to your computer and use it in GitHub Desktop.
handler error in `iced-coffee-script`
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
fs = require 'fs' | |
_z = (errcb, cb)-> | |
return ()-> | |
return errcb.apply null, arguments if arguments[0] | |
return cb.apply null, arguments | |
myfunc = (handler) -> # like `app.get '/', (req, res, next)->` in `express` | |
handler 'dummy1', 'dummy2', 'dummy3', 'dummy4', (err, data)-> | |
return console.error err.stack if err | |
console.log data if data | |
myfunc (param1, param2, param3, param4, next)-> | |
await fs.readFile param1, 'utf8', _z next, defer err, data | |
console.log "Data: #{data}" | |
await fs.readFile param2, 'utf8', _z next, defer err, data | |
console.log "Data: #{data}" | |
await fs.readFile param3, 'utf8', _z next, defer err, data | |
console.log "Data: #{data}" | |
await fs.readFile param4, 'utf8', _z next, defer err, data | |
console.log "Data: #{data}" | |
console.log 'complete' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@xinyu198736