From f10e09d53ded150d73846cff1859bc9966a58303 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Sat, 3 Dec 2022 00:23:15 +0900 Subject: [PATCH] doc: use console.error for error case in child_process and dgram console.error is more suitable than console.log for error case. PR-URL: https://github.com/nodejs/node/pull/45690 Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig --- doc/api/child_process.md | 4 ++-- doc/api/dgram.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 27566c44cf9312..f2f1755f4a9b2e 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -272,7 +272,7 @@ const { exec } = require('node:child_process'); const controller = new AbortController(); const { signal } = controller; const child = exec('grep ssh', { signal }, (error) => { - console.log(error); // an AbortError + console.error(error); // an AbortError }); controller.abort(); ``` @@ -384,7 +384,7 @@ const { execFile } = require('node:child_process'); const controller = new AbortController(); const { signal } = controller; const child = execFile('node', ['--version'], { signal }, (error) => { - console.log(error); // an AbortError + console.error(error); // an AbortError }); controller.abort(); ``` diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 84fd2684266c3f..d984e871af553e 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -16,7 +16,7 @@ import dgram from 'node:dgram'; const server = dgram.createSocket('udp4'); server.on('error', (err) => { - console.log(`server error:\n${err.stack}`); + console.error(`server error:\n${err.stack}`); server.close(); }); @@ -38,7 +38,7 @@ const dgram = require('node:dgram'); const server = dgram.createSocket('udp4'); server.on('error', (err) => { - console.log(`server error:\n${err.stack}`); + console.error(`server error:\n${err.stack}`); server.close(); }); @@ -268,7 +268,7 @@ import dgram from 'node:dgram'; const server = dgram.createSocket('udp4'); server.on('error', (err) => { - console.log(`server error:\n${err.stack}`); + console.error(`server error:\n${err.stack}`); server.close(); }); @@ -290,7 +290,7 @@ const dgram = require('node:dgram'); const server = dgram.createSocket('udp4'); server.on('error', (err) => { - console.log(`server error:\n${err.stack}`); + console.error(`server error:\n${err.stack}`); server.close(); });