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

Add swallowedRejection event to eventually replace multipleResolves #43165

Closed
dead-claudia opened this issue May 21, 2022 · 2 comments
Closed
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@dead-claudia
Copy link

dead-claudia commented May 21, 2022

What is the problem this feature will solve?

I need to be able to capture and log errors that are swallowed by the likes of Promise.all and Promise.race. multipleResolves currently fills that gap, but #41554 is deprecating the hook as it didn't really pan out.

What is the feature you are proposing to solve the problem?

A swallowedRejection hook fired any time a source promise to Promise.all/Promise.race rejects after the returned promise settles. This would not fire on multiple resolutions, avoiding performance impact there.

What alternatives have you considered?

  1. Pushing for Deprecate multipleResolves? #41554 to be reversed. Obviously, that's not going to happen, so I didn't even bother trying.
  2. Getting new Promise.* methods to replace the above ones.
@dead-claudia dead-claudia added the feature request Issues that request new features to be added to Node.js. label May 21, 2022
@bnoordhuis
Copy link
Member

For my understanding: you're interested in the second (or third, or...) source promise to Promise.all() or Promise.race() that rejects? Because you already know the first rejected promise, of course.

I don't think V8's promise hook mechanism is specific enough to scope it to just Promise.all() and Promise.race(). You said "the likes of" - what other sources are you thinking of?

@benjamingr
Copy link
Member

The problem with multipleResolves is that it "didn't work right".

I'm not sure where people are expected to use what you're suggesting given that Promise.all/Promise.race explicitly have this "ignore further rejections" behavior and there are methods (like allSettled or any) that don't.

@dead-claudia dead-claudia closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2022
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.
Projects
None yet
Development

No branches or pull requests

3 participants