0

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?

?

1
  • Generally servers handle exceptions at the top level (for example if it is a http server then by returning 500). Otherwise they would crash each time an exception occures. So whatever you are trying to achieve you have to do that inside the code. Commented Sep 4, 2016 at 16:59

1 Answer 1

1

You can handle global exceptions like so:

process.on('uncaughtException', (err) => {  
  // your logic here
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.