diff --git a/src/controllers/user.js b/src/controllers/user.js index 7263766615..b806130d2e 100644 --- a/src/controllers/user.js +++ b/src/controllers/user.js @@ -437,10 +437,12 @@ api.batchUpdate = function(req, res, next) { api[_req.op](_req, res); }; + res.locals.ops = []; // Setup the array of functions we're going to call in parallel with async var ops = _.transform(req.body, function(result, _req) { if (!_.isEmpty(_req)) { result.push(function(cb) { + res.locals.ops.push(_req); callOp(_req, cb); }); } diff --git a/src/utils.js b/src/utils.js index 0fb599fde9..791ba3c57c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -66,7 +66,8 @@ module.exports.errorHandler = function(err, req, res, next) { "\n\noriginalUrl: " + req.originalUrl + "\n\nauth: " + req.headers['x-api-user'] + ' | ' + req.headers['x-api-key'] + "\n\nheaders: " + JSON.stringify(req.headers) + - "\n\nbody: " + JSON.stringify(req.body); + "\n\nbody: " + JSON.stringify(req.body) + + (res.locals.ops ? "\n\ncompleted ops: " + JSON.stringify(res.locals.ops) : ""); module.exports.sendEmail({ from: "HabitRPG <" + nconf.get('SMTP_USER') + ">", to: nconf.get('ADMIN_EMAIL') || nconf.get('SMTP_USER'),