File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change @@ -142,20 +142,8 @@ myEmitter.emit('error', new Error('whoops!'));
142142// Throws and crashes Node.js
143143```
144144
145- To guard against crashing the Node.js process, a listener can be registered
146- on the [ ` process ` object's ` uncaughtException ` event] [ ] or the [ ` domain ` ] [ ] module
147- can be used. (Note, however, that the ` domain ` module has been deprecated.)
148-
149- ``` js
150- const myEmitter = new MyEmitter ();
151-
152- process .on (' uncaughtException' , (err ) => {
153- console .error (' whoops! there was an error' );
154- });
155-
156- myEmitter .emit (' error' , new Error (' whoops!' ));
157- // Prints: whoops! there was an error
158- ```
145+ To guard against crashing the Node.js process the [ ` domain ` ] [ ] module can be
146+ used. (Note, however, that the ` domain ` module has been deprecated.)
159147
160148As a best practice, listeners should always be added for the ` 'error' ` events.
161149
@@ -594,5 +582,4 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
594582[ `fs.ReadStream` ] : fs.html#fs_class_fs_readstream
595583[ `net.Server` ] : net.html#net_class_net_server
596584[ `process.on('warning')` ] : process.html#process_event_warning
597- [ `process` object's `uncaughtException` event ] : process.html#process_event_uncaughtexception
598585[ stream ] : stream.html
You can’t perform that action at this time.
0 commit comments