Skip to content

Commit 63ebcc4

Browse files
author
Amoki
committed
improve opbeat
1 parent da25369 commit 63ebcc4

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lib/helpers/hydrater.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ module.exports = function(hydraterFunction, childs, logger, errLogger) {
5252
if(!cleaner.called) {
5353
cleaner.called = true;
5454
if(err) {
55-
logError(err, {task: task, stdout: stdout, stderr: stderr});
55+
var extra = {
56+
stdout: stdout,
57+
stderr: stderr,
58+
};
59+
extra.task = JSON.stringify(task);
60+
extra.task = JSON.parse(extra.task);
61+
62+
logError(err, extra);
5663
child.reset();
5764
}
5865
else {
@@ -190,7 +197,10 @@ module.exports = function(hydraterFunction, childs, logger, errLogger) {
190197
async.waterfall([
191198
function logErrors(cb) {
192199
if(err) {
193-
logError(err, {task: task});
200+
var extra = {};
201+
extra.task = JSON.stringify(task);
202+
extra.task = JSON.parse(extra.task);
203+
logError(err, extra);
194204
errLogger("ERR hydrating " + ((task.file_path) ? task.file_path : task.document.id), err.toString());
195205
}
196206

@@ -217,7 +227,10 @@ module.exports = function(hydraterFunction, childs, logger, errLogger) {
217227
}
218228
], function(internalErr) {
219229
if(internalErr) {
220-
logError(internalErr, {task: task});
230+
var extra = {};
231+
extra.task = JSON.stringify(task);
232+
extra.task = JSON.parse(extra.task);
233+
logError(internalErr, extra);
221234
errLogger("INTERNAL ERR", internalErr);
222235
}
223236
done(err || internalErr, changes);

0 commit comments

Comments
 (0)