Navigation Menu

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 Jan 3, 2023
1 parent fcd0f71 commit 6e35803
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
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
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 6e35803

Please sign in to comment.