Skip to content

Commit

Permalink
doc: update console.error example
Browse files Browse the repository at this point in the history
Signed-off-by: Lee, Bonggi <iyabong@gmail.com>

PR-URL: #34964
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
iyabong authored and BethGriggs committed Dec 15, 2020
1 parent 47ba122 commit 8ef0652
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion doc/api/console.md
Expand Up @@ -30,7 +30,15 @@ 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 error message and stack trace to stderr:
// Error: Whoops, something bad happened
// at [eval]:5:15
// at Script.runInThisContext (node:vm:132:18)
// at Object.runInThisContext (node:vm:309:38)
// at node:internal/process/execution:77:19
// at [eval]-wrapper:6:22
// at evalScript (node:internal/process/execution:76:60)
// at node:internal/main/eval_string:23:3

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

0 comments on commit 8ef0652

Please sign in to comment.