Skip to content

Commit

Permalink
doc: using console.error for error cases in crypto and events
Browse files Browse the repository at this point in the history
PR-URL: #45640
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
emirgoren authored and danielleadams committed Dec 29, 2022
1 parent 9fe12ba commit ad2e2dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let crypto;
try {
crypto = require('node:crypto');
} catch (err) {
console.log('crypto support is disabled!');
console.error('crypto support is disabled!');
}
```

Expand All @@ -67,7 +67,7 @@ let crypto;
try {
crypto = await import('node:crypto');
} catch (err) {
console.log('crypto support is disabled!');
console.error('crypto support is disabled!');
}
```

Expand Down
8 changes: 4 additions & 4 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ process.nextTick(() => {
try {
await once(ee, 'myevent');
} catch (err) {
console.log('error happened', err);
console.error('error happened', err);
}
```

Expand All @@ -1067,7 +1067,7 @@ async function run() {
try {
await once(ee, 'myevent');
} catch (err) {
console.log('error happened', err);
console.error('error happened', err);
}
}

Expand All @@ -1086,7 +1086,7 @@ const ee = new EventEmitter();

once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.log('error', err.message));
.catch((err) => console.error('error', err.message));

ee.emit('error', new Error('boom'));

Expand All @@ -1100,7 +1100,7 @@ const ee = new EventEmitter();

once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.log('error', err.message));
.catch((err) => console.error('error', err.message));

ee.emit('error', new Error('boom'));

Expand Down

0 comments on commit ad2e2dd

Please sign in to comment.