Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 59d3d54

Browse filesBrowse files
theoludwigmhdawson
authored andcommitted
errors: disp ver on fatal except that causes exit
Display Node.js version at the end of stacktraces on fatal exception that causes exit. Easier for debugging so you don't have to ask "what node version are you on?", it is directly in the error the user copy/paste from when asking for help. Fixes: #29731 PR-URL: #38332 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 33b5107 commit 59d3d54
Copy full SHA for 59d3d54

File tree

Expand file treeCollapse file tree

57 files changed

+155
-2
lines changed
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

57 files changed

+155
-2
lines changed
Open diff view settings
Expand file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Collapse file

‎doc/node.1‎

Copy file name to clipboardExpand all lines: doc/node.1
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ It is kept for compatibility.
273273
.It Fl -no-deprecation
274274
Silence deprecation warnings.
275275
.
276+
.It Fl -no-extra-info-on-fatal-exception
277+
Hide extra information on fatal exception that causes exit.
278+
.
276279
.It Fl -no-force-async-hooks-checks
277280
Disable runtime checks for `async_hooks`.
278281
These will still be enabled dynamically when `async_hooks` is enabled.
Collapse file

‎src/node_errors.cc‎

Copy file name to clipboardExpand all lines: src/node_errors.cc
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ static void ReportFatalException(Environment* env,
414414
}
415415
}
416416

417+
if (env->options()->extra_info_on_fatal_exception) {
418+
FPrintF(stderr, "\nNode.js %s\n", NODE_VERSION);
419+
}
420+
417421
fflush(stderr);
418422
}
419423

Collapse file

‎src/node_options.cc‎

Copy file name to clipboardExpand all lines: src/node_options.cc
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
511511
"show stack traces on process warnings",
512512
&EnvironmentOptions::trace_warnings,
513513
kAllowedInEnvironment);
514+
AddOption("--extra-info-on-fatal-exception",
515+
"hide extra information on fatal exception that causes exit",
516+
&EnvironmentOptions::extra_info_on_fatal_exception,
517+
kAllowedInEnvironment,
518+
true);
514519
AddOption("--unhandled-rejections",
515520
"define unhandled rejections behavior. Options are 'strict' "
516521
"(always raise an error), 'throw' (raise an error unless "
Collapse file

‎src/node_options.h‎

Copy file name to clipboardExpand all lines: src/node_options.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class EnvironmentOptions : public Options {
150150
bool trace_tls = false;
151151
bool trace_uncaught = false;
152152
bool trace_warnings = false;
153+
bool extra_info_on_fatal_exception = true;
153154
std::string unhandled_rejections;
154155
std::string userland_loader;
155156
bool verify_base_objects =
Collapse file

‎test/message/assert_throws_stack.out‎

Copy file name to clipboardExpand all lines: test/message/assert_throws_stack.out
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
3232
expected: { bar: true },
3333
operator: 'throws'
3434
}
35+
36+
Node.js *
Collapse file

‎test/message/core_line_numbers.out‎

Copy file name to clipboardExpand all lines: test/message/core_line_numbers.out
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ RangeError: Invalid input
1212
at Function.Module._load (node:internal/modules/cjs/loader:*:*)
1313
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
1414
at node:internal/main/run_main_module:*:*
15+
16+
Node.js *
Collapse file

‎test/message/error_aggregateTwoErrors.out‎

Copy file name to clipboardExpand all lines: test/message/error_aggregateTwoErrors.out
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ AggregateError: original
1111
at node:internal/main/run_main_module:*:* {
1212
code: 'ERR0'
1313
}
14+
15+
Node.js *
Collapse file

‎test/message/error_exit.out‎

Copy file name to clipboardExpand all lines: test/message/error_exit.out
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
2020
expected: 2,
2121
operator: 'strictEqual'
2222
}
23+
24+
Node.js *
Collapse file

‎test/message/error_with_nul.out‎

Copy file name to clipboard
11 Bytes
Binary file not shown.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.