Almost correct.

But you have to add the 'error' listener before the .run call.
.run will immediately call the provided function, so if an error happens immediately, you wont catch it.

source:
Domain.prototype.run = function(fn) {
  return this.bind(fn)();
};

bind here refers to the documented domain#bind method.

Good luck.
danmilon.

On 08/10/2012 05:16 PM, Honigbaum wrote:
Ah, you're right.

You mean like this https://gist.github.com/3313918

Am Freitag, 10. August 2012 15:40:04 UTC+2 schrieb Dan Milon:

    That is wrong.

    The domain creation should be at the code of the slave.
    the slaves are the actual servers that share the port. Thats where
    the
    errors occur.
    master is a mere coordinator.

    Slave code is at the else part of cluster.isMaster.

    Also you create the server without regard of weather the process is
    master / slave. Functionally its the same (since you only listen
    for the
    slave) but i consider it bad practice.

    So the server creation code should go at the else part also.

    danmilon.

    On 08/10/2012 03:38 PM, Honigbaum wrote:
    > Hello,
    >
    > I tried it like this https://gist.github.com/3313918
    <https://gist.github.com/3313918>
    >
    > Or is it a problem that I assign ever domain to the same var?
    >
    >
    > Torben
    >
    > Am Freitag, 10. August 2012 14:32:03 UTC+2 schrieb Dan Milon:
    >
    >     How did you implement this exactly? (gist?)
    >     You should be able to create a domain inside the slave code
    that will
    >     fire whenever this specific slave throws.
    >
    >     danmilon.
    >
    >     On 08/10/2012 03:01 PM, Honigbaum wrote:
    >     > Hello,
    >     >
    >     > my node.js application uses the cluster module for forking
    >     workers and
    >     > I want to use the new domain module to catch all uncaught
    >     exceptions.
    >     >
    >     > Is there a way to fork each worker in an own domain? I
    tried to
    >     wrap
    >     > the whole application in an domain, but then the error
    handler is
    >     > called for each worker.
    >     >
    >     >
    >     > Thank you
    >     > Torben
    >     > --
    >     > Job Board: http://jobs.nodejs.org/
    >     > Posting guidelines:
    >     >
    >
    https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines 
<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
    <https://github.com/joyent/node/wiki/Mailing-List-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 nod...@googlegroups.com
    >     <javascript:>
    >     > To unsubscribe from this group, send email to
    >     > nodejs+un...@googlegroups.com <javascript:>
    >     > For more options, visit this group at
    >     > http://groups.google.com/group/nodejs?hl=en?hl=en
    <http://groups.google.com/group/nodejs?hl=en?hl=en>
    >     <http://groups.google.com/group/nodejs?hl=en?hl=en
    <http://groups.google.com/group/nodejs?hl=en?hl=en>>
    >
    > --
    > Job Board: http://jobs.nodejs.org/
    > Posting guidelines:
    >
    https://github.com/joyent/node/wiki/Mailing-List-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 nod...@googlegroups.com
    <javascript:>
    > To unsubscribe from this group, send email to
    > nodejs+un...@googlegroups.com <javascript:>
    > For more options, visit this group at
    > http://groups.google.com/group/nodejs?hl=en?hl=en
    <http://groups.google.com/group/nodejs?hl=en?hl=en>

--
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

--
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