prismicio / javascript-nodejs-starter

Starter project for NodeJS – Works with any prismic.io repository
34 stars 30 forks source link

If error, the app crashes; what is the best practice? #3

Closed rudyrigot closed 10 years ago

rudyrigot commented 10 years ago

If whatever error is raised, the server crashes; I don't know enough about node.js/express.js architecture to know if this is the right behavior (and to have the node executable handle errors differently in production, for instance), or if the nehavior should be changed.

I see there is something there, but since it's not in the app yet, I'm not sure this is the right way, I would love more experienced feedback: http://expressjs.com/guide.html#error-handling

rudyrigot commented 10 years ago

I've looked into this, and there's really not much literature about it out there, and all of it leads me to thing that the error handler seems to be properly positioned already, in the app.js file as:

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

But I don't get:

If anyone has pointers, I'd love it wildly !

rudyrigot commented 10 years ago

I found the cause of the issue, and a solution. It is in the development kit, so here are the explanations.