Interesting - benching it was my plan asap (as well as writing unit tests). I was kind of hoping that v8 would be making a simple copy of the stack trace it records anyway, and cheaply store that into the Error object somehow.
In any case, any form of pre-processing is way too intrusive to me, and paying even this high price for correctly captured stacktraces and for having a stable server program is a good tradeoff. I will see how cheap is to access the stacktrace or at least the line- number before the async call, and optimize this out, when I get time. J. On Feb 13, 10:25 am, Bruno Jouhier <[email protected]> wrote: > I had to handle this in streamline and I also did it similarly with a > small callback wrapper that does the try/catch. > > On the other hand, I found that allocating an Error object to keep > track of the source stack is very costly (a new Error call costs 400 > empty object {} allocations) so I chose to generate code to track the > stack trace instead. Works well but this is something you can only > reasonably do by preprocessing. > > My little bench:https://gist.github.com/1814923 > > You can solve the whole EH problem (stack traces + try/catch/finally) > with a preprocessor or fibers (or both combined). > > Bruno. > > On Feb 13, 1:54 am, Juraj Vitko <[email protected]> wrote: > > > > > > > > > Wow, I did not know about domains. In the meantime, what approach do > > you take for async error handling? > > > I have found multiple libs but they all were too intrusive and/or > > syntax-sugary, so I attempted my own, which I do > > use:https://github.com/ypocat/laeh2 > > > Always looking for better methods though. > > > On Feb 10, 7:33 pm, Brad Carleton <[email protected]> wrote: > > > > That sounds great! I really hope this is able to make it into 0.8. > > > > On Feb 10, 11:23 am, Ben Noordhuis <[email protected]> wrote: > > > > > On Fri, Feb 10, 2012 at 16:42, Brad Carleton <[email protected]> wrote: > > > > > Very interesting, so could a domain cover an entire request in your > > > > > typical web application. Basically,giving you the ability to respond > > > > > to any error that may occur in an async callback, because the domain > > > > > would be keeping the context of the initial request? That would be a > > > > > really big win for request based concurrent systems like web apps. > > > > > Yes, that's about right. -- 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
