Improve exception logging to make swallowing/reraising explicit in all cases.

This commit is contained in:
Pavel Minaev 2020-02-20 17:21:21 -08:00 committed by Pavel Minaev
parent bf1fbbc8ee
commit de9ea2cb9c
20 changed files with 93 additions and 92 deletions

View file

@ -47,12 +47,12 @@ class BackChannel(object):
if self._server_socket is None:
return
else:
raise log.exception("Timed out waiting for {0} to connect", self)
log.reraise_exception("Timed out waiting for {0} to connect", self)
except Exception:
if self._server_socket is None:
return
else:
raise log.exception("Error accepting connection for {0}:", self)
log.reraise_exception("Error accepting connection for {0}:", self)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
log.info("Incoming connection from {0} accepted.", self)

View file

@ -227,7 +227,7 @@ class Session(object):
self.wait_for_exit()
else:
# Log the error, in case another one happens during shutdown.
log.exception(exc_info=(exc_type, exc_val, exc_tb))
log.swallow_exception(exc_info=(exc_type, exc_val, exc_tb))
if exc_type is None:
self.disconnect()
@ -498,7 +498,7 @@ class Session(object):
self.spawn_debuggee(args, cwd, exe=exe)
return {}
except OSError as exc:
log.exception('"runInTerminal" failed:')
log.swallow_exception('"runInTerminal" failed:')
raise request.cant_handle(str(exc))
else:
raise request.isnt_valid("not supported")