Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node eventemitter emit error

// If an EventEmitter does not have at least one listener 
// registered for the 'error' event, and an 'error' event 
// is emitted, the error is thrown, a stack trace is printed, 
// and the Node.js process exits.

const myEmitter = new MyEmitter();
myEmitter.emit('error', new Error('whoops!'));
// Throws and crashes Node.js
 
PREVIOUS NEXT
Tagged: #node #eventemitter #emit #error
ADD COMMENT
Topic
Name
2+6 =