Skip to content

Commit

Permalink
doc: fix uncaught exception example
Browse files Browse the repository at this point in the history
PR-URL: #51638
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
  • Loading branch information
gabrielschulhof authored and targos committed Feb 15, 2024
1 parent a8ac337 commit 37182c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/api/process.md
Expand Up @@ -360,12 +360,13 @@ exit with 0.

```mjs
import process from 'node:process';
import fs from 'node:fs';

process.on('uncaughtException', (err, origin) => {
fs.writeSync(
process.stderr.fd,
`Caught exception: ${err}\n` +
`Exception origin: ${origin}`,
`Exception origin: ${origin}\n`,
);
});

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

```cjs
const process = require('node:process');
const fs = require('node:fs');

process.on('uncaughtException', (err, origin) => {
fs.writeSync(
process.stderr.fd,
`Caught exception: ${err}\n` +
`Exception origin: ${origin}`,
`Exception origin: ${origin}\n`,
);
});

Expand Down

0 comments on commit 37182c4

Please sign in to comment.