Created
March 18, 2014 20:13
-
-
Save ryanflorence/9628510 to your computer and use it in GitHub Desktop.
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.readFile('foo', hcb(function(data) { | |
// do something | |
}); | |
function hcb() { | |
var args = [].slice.call(arguments, 0); | |
var err = args.shift(); | |
if (err != null) { | |
handleError(err); | |
return; | |
} | |
cb.call(null, args); | |
} | |
function handleError(err) { | |
if (ENV.dev) { | |
throw new Error(); | |
} | |
else { | |
log(err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment