Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created March 18, 2014 20:13
Show Gist options
  • Save ryanflorence/9628510 to your computer and use it in GitHub Desktop.
Save ryanflorence/9628510 to your computer and use it in GitHub Desktop.
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