view raw
notker notker - 8 months ago 77
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?



You can handle global exceptions like so:

process.on('uncaughtException', (err) => {  
  // your logic here