Skip to content

Commit 1117500

Browse files
committed
more cases for known connection errors we don't need debug info about
this logs a shorter message with just the error code instead of the traceback
1 parent 6792ceb commit 1117500

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

lib/configproxy.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,20 @@ class ConfigurableProxy extends EventEmitter {
425425
this.statsd.increment("requests." + code, 1);
426426
if (e) {
427427
// avoid stack traces on known not-our-problem errors:
428-
// ECONNREFUSED (backend isn't there)
429-
// ECONNRESET (backend is there, but didn't respond)
430-
if (e.code === "ECONNRESET" || e.code === "ECONNREFUSED") {
431-
errMsg = e.message;
432-
} else {
433-
// logging the error object shows a stack trace.
434-
// Anything that gets here is an unknown error,
435-
// so log more info.
436-
errMsg = e;
428+
// ECONNREFUSED, EHOSTUNREACH (backend isn't there)
429+
// ECONNRESET, ETIMEDOUT (backend is there, but didn't respond)
430+
switch (e.code) {
431+
case "ECONNREFUSED":
432+
case "ECONNRESET":
433+
case "EHOSTUNREACH":
434+
case "ETIMEDOUT":
435+
errMsg = e.message;
436+
break;
437+
default:
438+
// logging the error object shows a stack trace.
439+
// Anything that gets here is an unknown error,
440+
// so log more info.
441+
errMsg = e;
437442
}
438443
}
439444
this.log.error("%s %s %s %s", code, req.method, req.url, errMsg);

0 commit comments

Comments
 (0)