The Node.js documentation about the “domain” error handling module has a strongly worded warning imploring you to shut down the process when a domain catches an error.
I was recently asked for a more detailed explanation of why this is, and answered with the following gist.
This is not so bad if it’s a program that isn’t long-lived. PHP scripts typically run to completion and then get cleaned up, so a missed exception is pretty meh. Same with command line scripts.
But in a server or some other sort of long-lived daemon, it’s completely unacceptable, and will nearly always lead to undesirable system behavior.
Finish up what you’re doing, close the active connections or whatever, and GTFO. Let the system start a new process.
It’s the only responsible option.