return json on all server errors

This commit is contained in:
Josh Harvey 2014-05-03 16:26:32 -04:00
parent 955cc634a2
commit 72e7c8addc

View file

@ -73,9 +73,8 @@ module.exports = function (options) {
config.isAuthorized(fingerprint, function (err, device) {
if (err) {
var serverError = new Error('Internal Server Error');
serverError.status = 500;
return next(serverError);
res.json({err: 'Internal Server Error'});
return next(err);
}
if (!device) {
res.statusCode = 404;