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