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

async_wrap: provide a way to act as an asynchronous try-catch #7040

Closed
acarstoiu opened this issue May 28, 2016 · 8 comments
Closed

async_wrap: provide a way to act as an asynchronous try-catch #7040

acarstoiu opened this issue May 28, 2016 · 8 comments

Comments

@acarstoiu
Copy link

@trevnorris, in just a few words, the async_wrap module should be capable of acting like a try{} catch() {} over asynchronous fragments, including nextTick (I'm aware of #6082) and timers. Why? To pave the way to replacing the current error domains.

In my view, the execution should simply not get to process._fatalException when the error is handled. I noticed that the API presented in this talk doesn't even pass the thrown value.

@trevnorris
Copy link
Contributor

I originally implemented this behavior in AsyncListener almost 3 years ago (ref bc39bdd and 828f145). It leads to a hairy mess, and while I'm not opposed to it, it definitely won't be going into the initial public API. As a work around it is possible to setup and tear down an 'uncaughtException' handler in the pre/post callbacks. That should allow you to catch anything.

So, in short, let's wait until after initial implementation before discussing how to implement this.

@acarstoiu acarstoiu changed the title async_wrap: provide way to act as an asynchronous try-catch async_wrap: provide a way to act as an asynchronous try-catch Jun 2, 2016
@acarstoiu
Copy link
Author

While I can live with using an uncaughtException listener (which can be interferred with by the running code), do you plan to have complete support for all asynchronous calls, including nextTick and timers in this initial release?

@trevnorris
Copy link
Contributor

Yes. Initial release will have full support for timers, nextTick and a few other things that currently aren't properly supported.

@acarstoiu
Copy link
Author

Great 👍

@acarstoiu
Copy link
Author

Any progress on this? I really hope not to run on quick sands forever (namely, relying on the current error domains).

@trevnorris
Copy link
Contributor

Yes. I'm furiously finishing it up in preparation for a PR.

@acarstoiu
Copy link
Author

Any news on this?

@addaleax
Copy link
Member

@acarstoiu You can track the progress of this at #11883, subscribe to that thread and you’ll know when this gets merged. :) I’m closing this, but feel free to let us know if it should be re-opened, or ask any follow-up questions that you have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants