Bad connections or dead upstreams cannot be solved looking at a
backtrace, so avoid polluting logs with them and making other
problems less visible.
---
 lib/yahns/proxy_pass.rb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb
index e86e9c9..7083104 100644
--- a/lib/yahns/proxy_pass.rb
+++ b/lib/yahns/proxy_pass.rb
@@ -72,6 +72,9 @@ class Yahns::ProxyPass # :nodoc:
         send_req_buf(req)
       end
     rescue => e
+      # avoid polluting logs with a giant backtrace when the problem isn't
+      # fixable in code.
+      e.set_backtrace([]) if Errno::ECONNREFUSED === e
       c.proxy_err_response(502, self, e, nil)
     end
 
-- 
EW


Reply via email to