I used to program with Ruby on rails and I have just started SailsJS. With rails when I had an error in my backend, it didnt kill my server. I used to have a nice error displayed in my web browser and I even used the gem better error to have a live console displayed in my webbrowser when an error occured. How can I prevent the server to shut down everytime there's an error in Sails JS ? Is there a way to have a nice way to display errors with Sails (with the live console in the web browser, just like with the gem better errors) ?
Asked
Active
Viewed 402 times
1 Answers
1
For running your server despite errors, take a look at foreverjs. However, I'd advise you to be defensive about your programming and properly handle errors.

gcandal
- 937
- 8
- 23
-
I know I should not let errors in my application, but the fact that the sever having to restart the server whenever there's an error is very annoying...You dont have to do that with Rails. I am talking about dev environment. – David Geismar Nov 12 '15 at 10:09
-
You can add a generic error handler yourself, using https://nodejs.org/api/process.html like so: process.on('uncaughtException', function(error) { //print to console, etc }); Unlike Rails, node.js is not supposed to be an heavyweight framework, it is more of a set of networking libraries. This behaviour is not a technical flaw, it's a design decision. – gcandal Nov 12 '15 at 10:13