-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught, unspecified 'error' event #215
Comments
Could you please post the stack trace from the error as well as the version of EE2 you have installed? |
It seems that if you are not listening on the error event when it is emitted EvenEmmiter will throw this error. The error can be reproduced like this const EventEmitter2 = require('eventemitter2').EventEmitter2;
const events = new EventEmitter2();
console.log('sending first error event');
try {
events.emit('error', 'The error data');
} catch(e) {
console.log('caught error', e);
}
events.on('error', (error) => { console.log('got error event', error); });
console.log('sending second error event');
try {
events.emit('error', 'The error data');
} catch(e) {
console.log('caught error', e);
} sending first error event
caught error Error: Uncaught, unspecified 'error' event.
at EventEmitter.emit (/home/agirorn/code/test/node_modules/eventemitter2/lib/eventemitter2.js:398:15)
at Object.<anonymous> (/home/agirorn/code/test/t.js:6:10)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
sending second error event
got error event The error data |
Thanks for the details, sadly I'm a bit busy at the moment, but a PR seems like it wouldn't be too hard to do and would be very much welcome! |
I think think this is a similar case to the uncaught promise exception. When it occurs in node.js it is output to the console and the unhandledRejection event is sent. Could this be similar and somehow use the node.js I checked in node 6.12.0 and the process object is an event emitter object and can be used to do this. process.on('warning', (m) => console.log(`got warning ${m}`));
process.emit('warning', 'test')
=> got warning test
=> true Would that be an acceptable solution to this? |
Closes #215 added ignoreErrors option;
Hi !
For the first time i'm facing a problem with EE2, here is the code:
Each time i got this error
Uncaught, unspecified 'error' event
, when i change the event name for any other name the event is correctly emitted.I don't understand why i have this behavior, this kind of feature works on any other components of my project.
The text was updated successfully, but these errors were encountered: