Improve exception handling of fingerclient

This is to improve the following traceback, today we don't display what
server / port is.

  Traceback (most recent call last):
    File "/opt/venv/zuul-3.4.0/lib/python3.6/site-packages/zuul/lib/fingergw.py", line 80, in handle
      build_uuid,
    File "/opt/venv/zuul-3.4.0/lib/python3.6/site-packages/zuul/lib/fingergw.py", line 51, in _fingerClient
      with socket.create_connection((server, port), timeout=10) as s:
    File "/usr/lib/python3.6/socket.py", line 704, in create_connection
      for res in getaddrinfo(host, port, 0, SOCK_STREAM):
    File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -3] Temporary failure in name resolution

Change-Id: I2adb79b8fc3e12cb971b59e3d89c3dfc24a10a67
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-01-21 12:39:53 -05:00
parent 691b1bc17c
commit 669e2d66fa
1 changed files with 3 additions and 1 deletions

View File

@ -81,7 +81,9 @@ class RequestHandler(streamer_utils.BaseFingerRequestHandler):
except BrokenPipeError: # Client disconnect
return
except Exception:
self.log.exception('Finger request handling exception:')
self.log.exception(
'Finger request handling exception (%s:%s):',
port_location['server'], port_location['port'])
msg = 'Internal streaming error'
self.request.sendall(msg.encode('utf-8'))
return