errors: display Node.js version at the end of stacktraces on fatal exception that causes exit - #38332
theoludwig wants to merge 2 commits into
Conversation
|
If we want to add the Node.js version, I would only do that to fatal exceptions that cause Node.js to end. |
Right, thanks for sharing your thoughts. |
|
Before continuing further the work on this PR, I think it's better to gather some feedbacks from the Node.js community and main contributors. I made a file called throw new Error("Some random error...")Currently (with Node.js v16) by doing With the changes I made on this PR, here's the new output from the same file: I see that's also bumping the major version number, is that considered as a BREAKING CHANGE or is it only when testing locally with the local build ? Any thoughts ? |
That's not bumping the major version number, the
node/doc/guides/collaborator-guide.md Lines 341 to 348 in 005ebaf I don't think it qualifies as breaking change.
I think they meant that doing |
|
@gireeshpunathil what's your thought on this one. I'm thinking it might be useful to have the additional info in the strack trace but I'm wondering if there are some down sides that I'm not thinking of? |
|
Thanks for your concise answer! @aduh95 Right @mhdawson, I'm happy to continue the work for this PR. |
|
via Node.js version at would be a nice touch, but I doubt node runtime has that info by default...maybe its process.argv[0] |
|
any extra bit of info is definitely useful from the diagnostics point of view. The side effect of this I can think of are CI and external tools - that may have static assumptions about the shape /structure of the stack trace. I suggest to run CITGM tests too, once the CI passes - that can potentially give us hint around what can break and how. fixing CI is easy, but bit laborious.
|
|
@divlo if you change this to only be attached for fatal exceptions, you won't have to change as many tests. The last JS code that is run before exiting is: node/lib/internal/process/execution.js Lines 170 to 182 in ba84524 Line 282 in ba84524 Lines 396 to 399 in ba84524 |
|
Following @BridgeAR recomendations, here's the new behavior (in a file called Version should be printed
throw new Error('Some random error...')
Version should not be printed because the error is in a try/catch
try {
throw new Error('Some random error...')
} catch (error) {
console.error(error)
}
Version should be printed (in addition to
|
|
Now that the CI pass, what is needed to move this PR forward ? @mhdawson @gireeshpunathil |
aduh95
left a comment
There was a problem hiding this comment.
Overall this LGTM, thanks for the hard work of fixing every stacktrace in the message tests. I'm a bit unsure if "via" is the correct word to use, but I also don't have a better suggestion :)
Just a few nits:
|
@aduh95 I agree about the wording. What do you think about removing it including the indentation? Just the plain |
I don't mind about the wording, both looks good to me. 😄 Is it correct ? EDIT: Sorry I closed the PR accidentally, instead of sending this message, it closed the PR. 😅. |
|
i think we should definitely keep the indentation. |
|
While I agree this should be SemVer minor I wonder if it would be prudent to avoid backporting out of an abundance of caution as it does affect a good number of our own tests and may do the same for others as well. @nodejs/tsc any thoughts on that? |
|
If you think it shouldn't be backported, then it should be semver-major. |
|
I'd be ok with marking it SemVer major even though technically its may not be. |
|
While declaring something semver-major automatically excludes it from being backported, we can alternatively add the dont-land-on labels to achieve the same thing for things that are not semver-major but we still do not want to land on earlier release lines. |
Sure, but if the reason for avoiding a backport is because we think the change can break someone, that's exactly what semver-major is for. |
|
|
Co-authored-by: Antoine du Hamel <[email protected]>
|
The CI keeps failing. |
|
It fails because of this error (I think): /cc @nodejs/build-infra |
commented
Sep 8, 2021
|
Landed as 59d3d54 |
commented
Sep 8, 2021
|
@divlo thanks for you work and patience on this one. |
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