We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3531043 commit a69dcc0Copy full SHA for a69dcc0
1 file changed
doc/api/events.md
@@ -142,20 +142,8 @@ myEmitter.emit('error', new Error('whoops!'));
142
// Throws and crashes Node.js
143
```
144
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
-```
+To guard against crashing the Node.js process the [`domain`][] module can be
+used. (Note, however, that the `domain` module has been deprecated.)
159
160
As a best practice, listeners should always be added for the `'error'` events.
161
@@ -594,5 +582,4 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
594
582
[`fs.ReadStream`]: fs.html#fs_class_fs_readstream
595
583
[`net.Server`]: net.html#net_class_net_server
596
584
[`process.on('warning')`]: process.html#process_event_warning
597
-[`process` object's `uncaughtException` event]: process.html#process_event_uncaughtexception
598
585
[stream]: stream.html
0 commit comments