Skip to content

implement process.exitWithException() #34051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jasnell opened this issue Jun 25, 2020 · 5 comments
Closed

implement process.exitWithException() #34051

jasnell opened this issue Jun 25, 2020 · 5 comments
Labels
feature request Issues that request new features to be added to Node.js. process Issues and PRs related to the process subsystem.

Comments

@jasnell
Copy link
Member

jasnell commented Jun 25, 2020

In the stalled PR #25715, @Fishrock123 was working to introduce a new API... from the original description:

Adds a public way to access node::FatalException from javascript, as process.exitWithException().

If an error stack is available on the value, this method of exiting does not add additional context, unlike regular re-throwing, yet also uses the regular error printing logic. This behavior is particularly desirable when doing 'fatal exits' from the unhandledRejection event.

While the PR had plenty of support to move forward, there was an edge case around the uncaughtException event handler that would need to be worked through in order for it to move forward.

The original PR stalled out and has been closed, but given the support the idea had, I wanted to make sure to open a Feature Request issue in case someone else wanted to pick up the work and move it forward.

@jasnell jasnell added feature request Issues that request new features to be added to Node.js. process Issues and PRs related to the process subsystem. labels Jun 25, 2020
@bnoordhuis
Copy link
Member

This behavior is particularly desirable when doing 'fatal exits' from the unhandledRejection event.

Is that different from this?

process.on('unhandledRejection', err => {
  console.error(err)
  process.exit(42)
})

I assume the difference is that the proposed API also prints the line that threw? You probably don't always want to quit so I'd say that's better handled through a new API, one that gives you that line.

@bnoordhuis
Copy link
Member

@Fishrock123 @jasnell Can you comment on the above?

@jasnell
Copy link
Member Author

jasnell commented Jul 6, 2020

I have no particular preference on this. I opened issue so that the request didn't get lost since the original work stalled out.

@jasnell
Copy link
Member Author

jasnell commented Jan 12, 2021

Closing due to lack of progress

@jasnell jasnell closed this as completed Jan 12, 2021
@Fishrock123
Copy link
Contributor

The idea was essentially to expose the built-in error printing logic.

I also no longer have any investment in this, so, as we were.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants