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