Skip to content
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

unhandledRejection unconditionally prevents uncaughtExceptionMonitor #41222

Open
bmeck opened this issue Dec 17, 2021 · 2 comments
Open

unhandledRejection unconditionally prevents uncaughtExceptionMonitor #41222

bmeck opened this issue Dec 17, 2021 · 2 comments
Labels
process Issues and PRs related to the process subsystem.

Comments

@bmeck
Copy link
Member

bmeck commented Dec 17, 2021

Version

No response

Platform

No response

Subsystem

process

What steps will reproduce the bug?

process.on('unhandledRejection', (err) => {console.trace('unhandledRejection', err);});
process.on('uncaughtExceptionMonitor', (err) => {console.trace('uncaughtExceptionMonitor', err);});
Promise.reject(new Error('from promise'));

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

There is some way to see the error in 'uncaughtExceptionMonitor', throwing inside of unhandledRejection converts the type to uncaughtException and loses context.

What do you see instead?

If you register unhandledRejection there is no way to get the default behavior of seeing it in uncaughtExceptionMonitor, it is completely prevented with no way to opt-out.

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the process Issues and PRs related to the process subsystem. label Dec 17, 2021
@Flarna
Copy link
Member

Flarna commented Dec 18, 2021

if unhandledRejection is registered it eats the exception and as a result no uncaught exception happens (uncaughtException is also not emitted).

I assume this is intended similar as uncaughtException actually eats the exception and process is not ended.

Maybe adding a never listener unhandledRejectionMonitor similar to uncaughtExceptionMonitor which just indicates the unhandled rejection without any side effect would be the way forward here?

@bmeck
Copy link
Member Author

bmeck commented Dec 20, 2021

@Flarna i'm fairly open to ideas, marking a rejection as to be reported seems fine. Right now throwing inside of unhandledRejection does this but also causes some other stuff to happen and loses fromPromise. I'm a bit skeptical of adding a new event for this though. At least for use cases I don't see a need to report unhandledRejections that are actually handled intentionally by the program, but there is no way to make them as unhandled when you use unhandledRejection events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants