Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: update console.error example to API doc
'console.error(new Error())' method
prints not only custom message but also stack trace.

So i added stack trace lines to example box.

Signed-off-by: Lee, Bonggi <iyabong@gmail.com>
  • Loading branch information
iyabong committed Aug 29, 2020
commit 976ae4f28ecc5face8db9cc9faaed7562a7f0735
8 changes: 7 additions & 1 deletion doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ console.log('hello world');
console.log('hello %s', 'world');
// Prints: hello world, to stdout
console.error(new Error('Whoops, something bad happened'));
// Prints: [Error: Whoops, something bad happened], to stderr
// Prints: custom message and stack trace to stderr
Comment thread
iyabong marked this conversation as resolved.
Outdated
// Error: Whoops, something bad happened
// at Server.<anonymous> (D:\node-training\console_error_ex.js:13:15)
// at Object.onceWrapper (events.js:420:28)
// at Server.emit (events.js:314:20)
// at emitListeningNT (net.js:1350:10)
// at processTicksAndRejections (internal/process/task_queues.js:79:21)
Comment thread
iyabong marked this conversation as resolved.
Outdated

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
Expand Down