Windshaft-cartodb/lib/cartodb/api/middlewares/syntax-error.js

11 lines
283 B
JavaScript
Raw Normal View History

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);
};
};