Skip to content

Instantly share code, notes, and snippets.

@aroman
Created May 13, 2014 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aroman/15565eb7f533216fd4db to your computer and use it in GitHub Desktop.
Save aroman/15565eb7f533216fd4db to your computer and use it in GitHub Desktop.
named closures
// is this...
mongoose.connection.on('error', function onConnectionError(err) { // Closure is named
console.log('Error: Can not connect to DB'.red);
console.log(err.toString().red);
process.exit(1);
});
// ...better than this?
mongoose.connection.on('error', function (err) { // Closure is NOT named
console.log('Error: Can not connect to DB'.red);
console.log(err.toString().red);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment