notker notker - 2 years ago 179
Node.js Question

node.js exception handling server

Is there a exception manager for node.js that can do this:

If an expection gets thrown replace a file on server and change something in the database (eg. roll back to he version before) and restart the server. I know that there are managers like "pm2" oder "forever" but can they do something like this?


Answer Source

You can handle global exceptions like so:

process.on('uncaughtException', (err) => {  
  // your logic here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download