From 5b2929a6fca605ac7b18038aa5498e4064525f7a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 6 May 2020 13:50:48 -0400 Subject: [PATCH] suppress some useless info from some commonly logged errors --- lib/api.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/api.js b/lib/api.js index f615360c5..cc88aaed7 100644 --- a/lib/api.js +++ b/lib/api.js @@ -14,6 +14,7 @@ module.exports.create = function (config) { var special_errors = {}; ['EPIPE', 'ECONNRESET'].forEach(function (k) { special_errors[k] = noop; }); special_errors.NF_ENOENT = function (error, label, info) { + delete info.stack; log.error(label, { info: info, }); @@ -27,10 +28,11 @@ module.exports.create = function (config) { .on('sessionClose', historyKeeper.sessionClose) .on('error', function (error, label, info) { if (!error) { return; } - if (error && error.code) { + var code = error && (error.code || error.message); + if (code) { /* EPIPE,ECONNERESET, NF_ENOENT */ - if (typeof(special_errors[error.code]) === 'function') { - return void special_errors[error.code](error, label, info); + if (typeof(special_errors[code]) === 'function') { + return void special_errors[code](error, label, info); } }