Exceptions cause Node.js servers to crash. The common wisdom is that one needs to monitor Node.js processes and restart them on crash. Why can’t one just wrap the entire script in a try {} catch {} or listen for exception events?
It’s understood that catching all exceptions is bad because it leaves the interpreter in an unpredictable state. Is this actually true? Why? Is this an issue specific to V8?
Catching all exception does not leave the interpreter in a bad state, but may leave your application in a bad state. An uncaught exception means that something that you were expecting to work, failed, and your application does not know how to handle that failure.
For example, if your app is a web server that listens to port 80 for connections, and when the app launches the port is in use, an exception is raised. Your code may ignore it, and then the process may continue running without actually listening to the port, so the process will be futile, or handle it: print an error message, a warning, kill the other process, or any way you want it to be handled. But you can see why ignoring it is not a good idea.
Another example is failing to communicate with a database (dropping a connection, unable to connect, receiving an unexpected error). If you app flow does not catch the exception properly, but just ignores it, you may be sending the user an acknowledgement of an event that failed.