From 720c3eb8cb005802085ce733d4e016bf0fc6d8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Wed, 28 Mar 2018 13:35:19 +0200 Subject: [PATCH] changing msg var name for errorResponse --- app/middlewares/error.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/middlewares/error.js b/app/middlewares/error.js index 12cf9b90..d514877e 100644 --- a/app/middlewares/error.js +++ b/app/middlewares/error.js @@ -3,11 +3,10 @@ var errorHandlerFactory = require('../services/error_handler_factory'); module.exports = function errorMiddleware() { return function error(err, req, res, next) { const errorHandler = errorHandlerFactory(err); - - var msg = errorHandler.getResponse(); + let errorResponse = errorHandler.getResponse(); if (global.settings.environment === 'development') { - msg.stack = err.stack; + errorResponse.stack = err.stack; } if (global.settings.environment !== 'test') { @@ -23,14 +22,14 @@ module.exports = function errorMiddleware() { res.header('X-SQLAPI-Profiler', req.profiler.toJSONString()); } - setErrorHeader(msg, errorHandler.http_status, res); + setErrorHeader(errorResponse, errorHandler.http_status, res); res.header('Content-Type', 'application/json; charset=utf-8'); res.status(getStatusError(errorHandler, req)); if (req.query && req.query.callback) { - res.jsonp(msg); + res.jsonp(errorResponse); } else { - res.json(msg); + res.json(errorResponse); } if (req && req.profiler) {