cgmartin / sailsjs-angularjs-bootstrap-example

A suite of examples written for Sails.js, AngularJS, and Twitter Bootstrap
320 stars 105 forks source link

Seems like this project breaks sailsjs default error handling #15

Closed marcosnils closed 10 years ago

marcosnils commented 10 years ago

If I call next({error: "Error"}) within any controller i'd expect sails to handle it by the default error (500) middleware. However in this project this doesn't happen, instead I get an [object Object] output.

Any ideas what may be causing this misbehaviour?

Thanks!.

cgmartin commented 10 years ago

Hi @marcosnils, thanks for reporting this. I was able to reproduce.

Two issues: 1) The config/500.js was missing the 4th function argument, and express was ignoring it as an error handler middleware. 2) The 500.jade, 404.jade, etc. were using a deprecated doctype which was causing an error during express' render, always sending json back.

Fixes included in this commit: https://github.com/cgmartin/sailsjs-angularjs-bootstrap-example/commit/60d63213dc91c00d7d4b1aae339e2aac9984d705

Thanks again!

marcosnils commented 10 years ago

@cgmartin thanks for the quick reply!.

I've already validated the commit and i'm closing the issue!.