Skip to content

Commit

Permalink
doc: use console.error for error case in child_process and dgram
Browse files Browse the repository at this point in the history
console.error is more suitable than console.log for error case.

PR-URL: #45690
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
deokjinkim authored and danielleadams committed Jan 5, 2023
1 parent 9025d6c commit e1af8ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
```
Expand Down Expand Up @@ -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();
```
Expand Down
8 changes: 4 additions & 4 deletions doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
});

Expand Down Expand Up @@ -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();
});

Expand All @@ -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();
});

Expand Down

0 comments on commit e1af8ba

Please sign in to comment.