Skip to content

Commit ecfb3f1

Browse files
gabrielschulhofrichardlau
authored andcommitted
doc: fix uncaught exception example
PR-URL: #51638 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Akhil Marsonya <[email protected]>
1 parent d0d5bd0 commit ecfb3f1

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)