suppress some useless info from some commonly logged errors

pull/1/head
ansuz 5 years ago
parent bc8a122b87
commit 5b2929a6fc

@ -14,6 +14,7 @@ module.exports.create = function (config) {
var special_errors = {}; var special_errors = {};
['EPIPE', 'ECONNRESET'].forEach(function (k) { special_errors[k] = noop; }); ['EPIPE', 'ECONNRESET'].forEach(function (k) { special_errors[k] = noop; });
special_errors.NF_ENOENT = function (error, label, info) { special_errors.NF_ENOENT = function (error, label, info) {
delete info.stack;
log.error(label, { log.error(label, {
info: info, info: info,
}); });
@ -27,10 +28,11 @@ module.exports.create = function (config) {
.on('sessionClose', historyKeeper.sessionClose) .on('sessionClose', historyKeeper.sessionClose)
.on('error', function (error, label, info) { .on('error', function (error, label, info) {
if (!error) { return; } if (!error) { return; }
if (error && error.code) { var code = error && (error.code || error.message);
if (code) {
/* EPIPE,ECONNERESET, NF_ENOENT */ /* EPIPE,ECONNERESET, NF_ENOENT */
if (typeof(special_errors[error.code]) === 'function') { if (typeof(special_errors[code]) === 'function') {
return void special_errors[error.code](error, label, info); return void special_errors[code](error, label, info);
} }
} }

Loading…
Cancel
Save