I am using Express as my Node.js web framework with MongoDB as persistence layer. When I run the server with 'node app.js' command, and occasionally some error occur such as mongoose error or imagemagick error, the hole node process will die and not available from browser. I used Express' error handler but this is still happening. Can someone help?
Asked
Active
Viewed 1,211 times
1
-
What version of node are you using? I got around this using the clusters package and the process.on('death') message. Look at the example code for clusters on the node.js website – ControlAltDel Apr 16 '12 at 01:45
-
1@zhangxuefeng post this as an answer and then accept it - that way, other people with the same problem will see that there is a solution – Adam Hopkinson Apr 16 '12 at 08:49
-
Duplicate of http://stackoverflow.com/questions/5999373/how-do-i-prevent-node-js-from-crashing-try-catch-doesnt-work – TiansHUo Apr 16 '12 at 09:59
2 Answers
2
process.on('uncaughtException', function (err) {
console.error(err);
console.log("Node NOT Exiting...");
});

TiansHUo
- 8,509
- 7
- 45
- 57