Skip to content

Commit 4ae91ca

Browse files
author
Amoki
committed
improve opbeat and some istabul ignores
1 parent 57adac0 commit 4ae91ca

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

lib/helpers/hydrater.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ module.exports = function(hydraterFunction, childs, logger, errLogger) {
5252
if(!cleaner.called) {
5353
cleaner.called = true;
5454
if(err) {
55-
var extra = {
56-
stdout: stdout,
57-
stderr: stderr,
58-
};
59-
extra.task = JSON.stringify(task);
60-
extra.task = JSON.parse(extra.task);
55+
var extra = JSON.parse(JSON.stringify(task));
56+
extra.stdout = stdout;
57+
extra.stderr = stderr;
6158

6259
logError(err, extra);
6360
child.reset();
@@ -197,9 +194,7 @@ module.exports = function(hydraterFunction, childs, logger, errLogger) {
197194
async.waterfall([
198195
function logErrors(cb) {
199196
if(err) {
200-
var extra = {};
201-
extra.task = JSON.stringify(task);
202-
extra.task = JSON.parse(extra.task);
197+
var extra = JSON.parse(JSON.stringify(task));
203198
logError(err, extra);
204199
errLogger("ERR hydrating " + ((task.file_path) ? task.file_path : task.document.id), err.toString());
205200
}
@@ -226,10 +221,9 @@ module.exports = function(hydraterFunction, childs, logger, errLogger) {
226221
}
227222
}
228223
], function(internalErr) {
224+
/* istanbul ignore next */
229225
if(internalErr) {
230-
var extra = {};
231-
extra.task = JSON.stringify(task);
232-
extra.task = JSON.parse(extra.task);
226+
var extra = JSON.parse(JSON.stringify(task));
233227
logError(internalErr, extra);
234228
errLogger("INTERNAL ERR", internalErr);
235229
}

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports.createServer = function(config) {
2626

2727
utils.logError.config = config;
2828

29+
/* istanbul ignore next */
2930
if(config.opbeat && config.opbeat.secretToken) {
3031
var opbeat = require('opbeat');
3132
utils.logError.opbeat = opbeat(config.opbeat);

0 commit comments

Comments
 (0)