One of the things I love about node.js is that it forces you to come up with a style and stick with it for things like this. At http://ratchet.io our API servers are written in node.js and we chose the foo(err, callback) method.
I personally love this style even though it makes you write more boiler-plate code, it forces you to write exception-safe code from the start. Also, it forces a structure on all of your code that you can instantly recognize as missing if someone forgets to check for err in the callback.
If you can stick with the style, it's fairly difficult to write code that doesn't deal with errors gracefully.
I agree. One of the advantages of the (err, result) style is that it puts error handling directly in your face. The `result typeof Error` style does not.
In any case all I care about is that we choose one, and (err, result) is gaining traction, which is fine. While many are excited about domains, I am not. From my perspective, in practice, it will just add another incompatible style onto the pile.
I use the built-in clustering module (implementation is very simple) so a simple worker crash will result in the error being logged & the worker being restarted.
That's about the best you can do, unfortunately. You could always monkey patch the lib if you can figure out where it's crashing.
I personally love this style even though it makes you write more boiler-plate code, it forces you to write exception-safe code from the start. Also, it forces a structure on all of your code that you can instantly recognize as missing if someone forgets to check for err in the callback.
If you can stick with the style, it's fairly difficult to write code that doesn't deal with errors gracefully.