From ecfb3f18b3b80f184d162cddcfd54de78ce250ce Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Sat, 3 Feb 2024 09:36:37 -0800 Subject: [PATCH] doc: fix uncaught exception example PR-URL: https://github.com/nodejs/node/pull/51638 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Akhil Marsonya --- doc/api/process.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index f269e2961d14fe..25c3afb5126b3c 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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`, ); }); @@ -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`, ); });