Skip to content

Instantly share code, notes, and snippets.

@mattness
Created January 29, 2016 04:26
Show Gist options
  • Save mattness/adc451d095349c1d5468 to your computer and use it in GitHub Desktop.
Save mattness/adc451d095349c1d5468 to your computer and use it in GitHub Desktop.
Anonymous vs Named functions in backtraces
var EventEmitter = require('events').EventEmitter;
var e = new EventEmitter();
e.on('something', function() {
throw new Error('anonymous function crash');
});
e.on('something_else', function foo() {
throw new Error('named function crash');
});
e.emit(process.argv[2]);
@hnaoto
Copy link

hnaoto commented Jan 29, 2016

This is a good practice to follow. Thank you ^ ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment