suppress some useless info from some commonly logged errors

This commit is contained in:
ansuz 2020-05-06 13:50:48 -04:00
parent bc8a122b87
commit 5b2929a6fc

View file

@ -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);
}
}