Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 74ca50f

Browse files
committedFeb 1, 2024
doc: fix uncaught exception example
1 parent 68885d5 commit 74ca50f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎doc/api/process.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,13 @@ exit with 0.
360360

361361
```mjs
362362
import process from 'node:process';
363+
import fs from 'node:fs';
363364

364365
process.on('uncaughtException', (err, origin) => {
365366
fs.writeSync(
366367
process.stderr.fd,
367368
`Caught exception: ${err}\n` +
368-
`Exception origin: ${origin}`,
369+
`Exception origin: ${origin}\n`,
369370
);
370371
});
371372

@@ -380,12 +381,13 @@ console.log('This will not run.');
380381

381382
```cjs
382383
const process = require('node:process');
384+
const fs = require('node:fs');
383385

384386
process.on('uncaughtException', (err, origin) => {
385387
fs.writeSync(
386388
process.stderr.fd,
387389
`Caught exception: ${err}\n` +
388-
`Exception origin: ${origin}`,
390+
`Exception origin: ${origin}\n`,
389391
);
390392
});
391393

0 commit comments

Comments
 (0)
Please sign in to comment.