From 6505966611629eef5291a0766851abd8e89928b3 Mon Sep 17 00:00:00 2001 From: Divlo Date: Thu, 2 Sep 2021 01:59:45 +0200 Subject: [PATCH 1/2] errors: display version on fatal exception 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: https://github.com/nodejs/node/issues/29731 --- doc/api/cli.md | 8 ++++++++ doc/node.1 | 3 +++ src/node_errors.cc | 4 ++++ src/node_options.cc | 5 +++++ src/node_options.h | 1 + test/message/assert_throws_stack.out | 2 ++ test/message/core_line_numbers.out | 2 ++ test/message/error_aggregateTwoErrors.out | 2 ++ test/message/error_exit.out | 2 ++ test/message/error_with_nul.out | Bin 561 -> 572 bytes test/message/esm_display_syntax_error.out | 2 ++ .../message/esm_display_syntax_error_import.out | 2 ++ .../esm_display_syntax_error_import_module.out | 2 ++ .../message/esm_display_syntax_error_module.out | 2 ++ test/message/esm_loader_not_found.out | 2 ++ .../esm_loader_not_found_cjs_hint_bare.out | 2 ++ .../esm_loader_not_found_cjs_hint_relative.out | 2 ++ test/message/esm_loader_syntax_error.out | 2 ++ test/message/eval_messages.out | 12 ++++++++++++ .../events_unhandled_error_common_trace.out | 2 ++ .../message/events_unhandled_error_nexttick.out | 2 ++ .../message/events_unhandled_error_sameline.out | 2 ++ .../message/events_unhandled_error_subclass.out | 2 ++ test/message/if-error-has-good-stack.out | 2 ++ test/message/internal_assert.out | 2 ++ test/message/internal_assert_fail.out | 2 ++ test/message/nexttick_throw.out | 2 ++ test/message/promise_always_throw_unhandled.out | 2 ++ test/message/source_map_disabled_by_api.out | 2 ++ test/message/source_map_enabled_by_api.out | 2 ++ test/message/source_map_enclosing_function.out | 2 ++ .../message/source_map_reference_error_tabs.out | 2 ++ test/message/source_map_throw_first_tick.out | 2 ++ test/message/source_map_throw_icu.out | 2 ++ test/message/source_map_throw_set_immediate.out | 2 ++ test/message/stack_overflow.out | 2 ++ test/message/stdin_messages.out | 12 ++++++++++++ .../test-no-extra-info-on-fatal-exception.js | 6 ++++++ .../test-no-extra-info-on-fatal-exception.out | 12 ++++++++++++ test/message/throw_custom_error.out | 2 ++ test/message/throw_error_with_getter_throw.out | 2 ++ .../throw_error_with_getter_throw_traced.out | 2 ++ test/message/throw_in_line_with_tabs.out | 2 ++ test/message/throw_non_error.out | 2 ++ test/message/throw_null.out | 2 ++ test/message/throw_null_traced.out | 2 ++ test/message/throw_undefined.out | 2 ++ test/message/throw_undefined_traced.out | 2 ++ test/message/timeout_throw.out | 2 ++ .../undefined_reference_in_new_context.out | 2 ++ test/message/vm_display_runtime_error.out | 2 ++ test/message/vm_display_syntax_error.out | 2 ++ test/message/vm_dont_display_runtime_error.out | 2 ++ test/message/vm_dont_display_syntax_error.out | 2 ++ test/parallel/test-cli-node-options.js | 1 + test/parallel/test-error-reporting.js | 3 +-- test/pseudo-tty/test-fatal-error.out | 2 ++ 57 files changed, 155 insertions(+), 2 deletions(-) create mode 100644 test/message/test-no-extra-info-on-fatal-exception.js create mode 100644 test/message/test-no-extra-info-on-fatal-exception.out diff --git a/doc/api/cli.md b/doc/api/cli.md index 48bfd090f65ce4..f87b2476e0f6a6 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -605,6 +605,13 @@ added: v0.8.0 Silence deprecation warnings. +### `--no-extra-info-on-fatal-exception` + + +Hide extra information on fatal exception that causes exit. + ### `--no-force-async-hooks-checks`