Windshaft-cartodb/lib/api/middlewares/syntax-error.js
2019-10-07 09:40:50 +02:00

13 lines
298 B
JavaScript

'use strict';
module.exports = function syntaxError () {
return function syntaxErrorMiddleware (err, req, res, next) {
if (err.name === 'SyntaxError') {
err.http_status = 400;
err.message = `${err.name}: ${err.message}`;
}
next(err);
};
};