status + send on syntax error handler

This commit is contained in:
Raul Ochoa 2015-09-17 11:07:02 +02:00
parent 361dd00e9d
commit db8457af60

View File

@ -267,7 +267,7 @@ function bootstrap(opts) {
app.use(function(err, req, res, next) {
if (err) {
if (err.name === 'SyntaxError') {
res.send({ errors: [err.name + ': ' + err.message] }, 400);
res.status(400).json({ errors: [err.name + ': ' + err.message] });
} else {
next(err);
}