From f24217a400650e07793347140ac56a86cb99296c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Fri, 24 Nov 2017 18:06:17 +0100 Subject: [PATCH] cloning object and removing logs --- lib/cartodb/middleware/error-middleware.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/cartodb/middleware/error-middleware.js b/lib/cartodb/middleware/error-middleware.js index f372648d..5c20179a 100644 --- a/lib/cartodb/middleware/error-middleware.js +++ b/lib/cartodb/middleware/error-middleware.js @@ -19,7 +19,7 @@ module.exports = function errorMiddleware (/* options */) { statusCode = 204; } - logErrors(allErrors, statusCode, res); + logErrors(Object.assign({}, allErrors), statusCode, res); debug('[%s ERROR] -- %d: %s, %s', label, statusCode, err, err.stack); // If a callback was requested, force status to 200 @@ -164,10 +164,6 @@ function errorMessageWithContext(err) { } function logErrors(errors, statusCode, res) { - console.log(' -----------------------------') - console.log('logErrors'); - console.log(' -----------------------------') - if(!errors || !errors.length || !statusCode) { return; } @@ -179,7 +175,7 @@ function logErrors(errors, statusCode, res) { message: mainError.message, type: mainError.type, subtype: mainError.subtype - } + }; errorsLog.moreErrors = errors.map(error => { return { @@ -189,9 +185,5 @@ function logErrors(errors, statusCode, res) { }; }); - console.log(' -----------------------------') - console.log(errorsLog) - console.log(' -----------------------------') - res.set('X-Tiler-Errors', JSON.stringify(errorsLog)); } \ No newline at end of file