Hacker News new | ask | show | jobs
by scriby 4922 days ago
Will these examples protect you from thrown exceptions? Null reference exception? Oops, your callback isn't getting called -- and you're probably leaking resources or leaving things in an inconsistent state.

So the recommendation is to restart the process - but let's not forget that hundreds+ of other requests could currently be in the pipeline - are we just going to abort those too?

Ok, we'll clearly the solution is to wrap all our callbacks with try/catch! Shoot me now...

For large, sprawling applications used to support a business, something like https://github.com/scriby/asyncblock can resolve most of the headaches with async code, including error handling. It's worked out well for my team at work, which is building a "very large" node application.

Disclaimer: Asyncblock is my pet project.