Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4b35dfb

Browse filesBrowse files
lpincaMylesBorins
authored andcommitted
doc: avoid mentioning 'uncaughtException'
Avoid suggesting using `'uncaughtException'` for emitted errors. PR-URL: #16905 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 78b82b0 commit 4b35dfb
Copy full SHA for 4b35dfb

File tree

Expand file treeCollapse file tree

1 file changed

+2
-15
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-15
lines changed
Open diff view settings
Collapse file

‎doc/api/events.md‎

Copy file name to clipboardExpand all lines: doc/api/events.md
+2-15Lines changed: 2 additions & 15 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff 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

160148
As 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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.