> > Also, FWIW, I'm highly critical of domains for all the reasons stated > above, but I also very much want a solution to the problem they solve. My > recommended solution (with code) is trycatch, and as you can see from this > thread, I'm not the only one that would prefer a much cleaner, simpler > solution to error handling in node.js. > > That being said, I think node.js' error handling problem boils down to an > inability to catch asynchronous exceptions reliably, something > that's exacerbated by the lack of maturity of most 3rd-party libraries and > node.js' threadlessness and concurrency. uncaughtException is insufficient > as it loses context, and domains (at least currently) are insufficent for > the reasons stated above. > > I'm not sure all of those criteria can be addressed simultaneously without > creating new problems. Trycatch isn't a lot of code, but there's a fair > amount of complexity there, and shimming every call to process.nextTick, > setTimeout, EventEmitters, et al is not without cost. >
Yup. That's true. Ideally if, possible, trycatch would find a way to piggy-back on domains and forego shimming when performance matters (production) and lose probably just long-stack traces. Also, although shimming has a cost, it's negligible compared to crashing and restarting and IMHO is negligible compared to other performance hits like using promises, though should probably run some hard benchmarks. Domains themselves add a similar cost, requiring a constant tracking and switching of the active domain. Trycatch is highly optimized, though. Sounds like an opportunity for a performance comparison. Again, my ultimate desire is for someone else to do the heavy lifting in core, and to then piggy-back the trycatch API on top. As it stands now, it doesn't look like that would be possible, though it seems close. I'd love to hear your comparison of what exactly domains offer apart from the error-handling that trycatch offers. I know generally about the low-level resource cleanup like open fd and sockets, etc..., but perhaps you could go into detail? While rummaging through the source, my primary interest was more on how it was implemented than the additional features. Cheers, Adam Crabtree -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
