Hi there.

I'm starting using domain to catch exception from asynchronous code (the 
famous r.js optimizer, which unfortunately do not report error within 
callbacks).

I was able to catch errors, but something was weird: even caught, an error 
still pe propagated to other 'uncaughtException' handler.
And indeed, it's exactly what's implemented inside the code :

https://github.com/joyent/node/blob/master/lib/domain.js

function uncaughtHandler(er) {
>   // if there's an active domain, then handle this there.
>   // Note that if this error emission throws, then it'll just crash.
>   if (exports.active && !exports.active._disposed) {
>     util._extend(er, {
>       domain: exports.active,
>       domain_thrown: true
>     });
>     exports.active.emit('error', er);
>     if (exports.active) exports.active.exit();
>   } else if (process.listeners('uncaughtException').length === 1) {
>     // if there are other handlers, then they'll take care of it.
>     // but if not, then we need to crash now.
>     throw er;
>   }
> }
>
>
So my question is : my purpose is to stop error propagation, not just catch 
it. Are domains designed for this kind of usage ?

Thank you in advance.

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to