From 976ae4f28ecc5face8db9cc9faaed7562a7f0735 Mon Sep 17 00:00:00 2001 From: "Lee, Bonggi" Date: Sat, 29 Aug 2020 16:20:44 +0900 Subject: [PATCH 1/3] 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 --- doc/api/console.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/api/console.md b/doc/api/console.md index 9e223e6ee9d2be..1a4a5cba604de8 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -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 +// Error: Whoops, something bad happened +// at Server. (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) const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); From d6dfa0cba60b5e3c84bbe1bdd16f7b51740457c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B4=89=EC=B6=A9=EC=9D=B4?= <68013311+iyabong@users.noreply.github.com> Date: Sat, 24 Oct 2020 14:30:34 +0900 Subject: [PATCH 2/3] Update doc/api/console.md remove OS specific console log Co-authored-by: Antoine du Hamel --- doc/api/console.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index 1a4a5cba604de8..7f6ad70756c11e 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -32,11 +32,13 @@ console.log('hello %s', 'world'); console.error(new Error('Whoops, something bad happened')); // Prints: custom message and stack trace to stderr // Error: Whoops, something bad happened -// at Server. (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) +// 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!`); From 9428aa398b85fbffec2caffe12b8a659d40b5c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B4=89=EC=B6=A9=EC=9D=B4?= <68013311+iyabong@users.noreply.github.com> Date: Sat, 24 Oct 2020 14:31:17 +0900 Subject: [PATCH 3/3] Update doc/api/console.md remove custom message Co-authored-by: Antoine du Hamel --- doc/api/console.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/console.md b/doc/api/console.md index 7f6ad70756c11e..42a317f204c379 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -30,7 +30,7 @@ console.log('hello world'); console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); -// Prints: custom message and stack trace 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)