Or you can use fibers) All excepions from async tasks will be bubbling to 
your fiber and you can catch its by try-catch

четверг, 17 января 2013 г., 1:58:43 UTC+4 пользователь Ben Noordhuis 
написал:
>
> On Wed, Jan 16, 2013 at 7:51 PM, mjosephd <[email protected] <javascript:>> 
> wrote: 
> > Hi All, 
> > 
> > In node.js the server crashes whenever an exception is thrown, I also 
> read 
> > up that it IS possible to catch uncaught exceptions but the best 
> practice is 
> > to do any necessary precautions such as logging details and then 
> restarting 
> > the server. However if multiple users are performing various actions 
> this 
> > would have the system become inconsistent, for example a transaction 
> > (multiple db calls for one process) was taking place and the server 
> > restarted in the middle, multiple web service call for the same process 
> and 
> > again the server restarted in the middle and such similar scenarios. 
> > 
> > At the moment we are considering of using node.js for an enterprise 
> solution 
> > which involves multiple requests from multiple users very often to the 
> > node.js server and it is also critical that no data is saved incorrectly 
> > either. This is the only hurdle so far I see and would like to know the 
> best 
> > way of handling uncaught exceptions considering that multiple users will 
> be 
> > sending many requests regularly to the node.js server. 
> > 
> > Regards, 
> > Mjosephd 
>
> You may want to look into what the domain module[1] has to offer.  To 
> quote the preface: 
>
> "Domains provide a way to handle multiple different IO operations as a 
> single group. If any of the event emitters or callbacks registered to 
> a domain emit an error event, or throw an error, then the domain 
> object will be notified, rather than losing the context of the error 
> in the process.on('uncaughtException') handler, or causing the program 
> to exit with an error code." 
>
> [1] http://nodejs.org/api/domain.html 
>

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

Reply via email to