On Thursday, October 4, 2012 9:39:43 AM UTC+2, Domenic Denicola wrote: > > > On Thursday, October 4, 2012 7:55:50 AM UTC+2, Mikeal Rogers wrote: >> >> Domains work OOTB on all event emitters but have some complications with >> callbacks and streams. >> >> Streams that are long running (like the redis client) don't get scoped to >> the right domain since they are created early and never destroyed. >> >> Callbacks are not automatically bound to a domain, so any "normal" code >> in them that throws will not be caught by the domain. >> >> At Summer Camp we discussed the best way to handle this problem. The >> solution seemed to be that module authors, like the redis client, should >> not scope their stream to a domain but instead must bind any callbacks >> passed to them to process.domain if one exists. I would say the same should >> go for libraries like async and any other library that "manages callbacks" >> >> This is a very long way of getting at what I think is the most important >> part of flow control discussions after 0.8, that regardless of the >> abstractions you use everyone needs to find a way to attach their errors to >> the "active" domain if they want to be compatible with error handling in >> node.js. Just like a promise library needs to expose something compatible >> with the callback interface to get at APIs in core it'll need to check for >> process.domain and bind it's success callbacks and error handling to it. >> > > I would love to play nicely with domains, but I'm not sure it's as > straightforward as this. Promise libraries wrap all callbacks in a > try/catch, storing any errors for potential future listeners, so there are > no truly unhandled exceptions---simply ones that nobody has listened for, > yet. So I'm not sure how you would surface those to a domain, or if it's > even appropriate to do so. Guidance definitely appreciated. >
Domenic, I think it's only about unhandled errors, so in fact errors thrown by 'end', they probably should be covered by domains in Node. I would definitely not incorporate domain logic into 'then' error handling. -- 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
