From 39a65fbc767a69b1394e02e1ed5ba87564358c49 Mon Sep 17 00:00:00 2001 From: Scott Gress Date: Wed, 23 Dec 2015 14:26:29 -0600 Subject: [PATCH] Moved logic so that body parser errors are still logged to console in production env (just not sent w/ response) refs #3347 --- lib/hooks/http/middleware/defaults.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hooks/http/middleware/defaults.js b/lib/hooks/http/middleware/defaults.js index 04475992a..17e4ff31f 100644 --- a/lib/hooks/http/middleware/defaults.js +++ b/lib/hooks/http/middleware/defaults.js @@ -168,11 +168,11 @@ module.exports = function(sails, app) { // is overridden in userland. Should probably be phased out at some point, // since it could be accomplished more elegantly- btu for now it's practical.) handleBodyParserError: function handleBodyParserError(err, req, res, next) { + var bodyParserFailureErrorMsg = 'Unable to parse HTTP body- error occurred :: ' + util.inspect((err&&err.stack)?err.stack:err, false, null); + sails.log.error(bodyParserFailureErrorMsg); if (IS_PRODUCTION && sails.config.keepResponseErrors !== true) { return res.send(400); } - var bodyParserFailureErrorMsg = 'Unable to parse HTTP body- error occurred :: ' + util.inspect((err&&err.stack)?err.stack:err, false, null); - sails.log.error(bodyParserFailureErrorMsg); return res.send(400, bodyParserFailureErrorMsg); },