Keep NodeJS Alive With Uncaught Exception

odeJS is still a pretty young project, and as you might expect, things can sometimes go wrong with out any obvious reason as to why. The [http module](http://nodejs.org/api/http.html) for example, especially in some earlier versions of node, will just throw an error and die - bringing your application down with out batting an eye! While not the most desireable method, you can pretty much catch any error comming from a NodeJS process and react accordingly:

NodeJS exposes a global object called process that you can listen for the uncaughtException event oddly enough, which you can listen to. As long as your handlers do not throw errors, your Node app will continue to run as usual. You would obviously want to do something a little more useful here like logging your error somewhere they could be viewed for debugging purposes, etc. But, That is really all there is to it!

I'm a software developer and system architect working at help.com. Most of my day is spent working with Javascript & Node.js. I've also done a good deal of web and print design work in my day. I created this space to share my experiences with the world and hopefully learn something in the process.

This Space

Here you will find my ramblings and rants about web development. My focus is around JavaScript( MooTools, Sencha, NodeJS ), Python & Django, HTML & CSS. Most things here target a wide range of skill levels - from the very simple to the moderately complicated. You may also find the occasionaly personal ranting and I may stand on a soap box from time to time.