Clean up logging of exceptions.

This commit is contained in:
Dain Nilsson 2022-05-13 09:04:22 +02:00
parent 50355d241e
commit 661a8012cd
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
2 changed files with 8 additions and 8 deletions

View File

@ -195,8 +195,8 @@ class RpcNode:
logger.debug("close existing child: %s", self._child_name)
try:
self._child.close()
except Exception as e:
logger.error("Error closing child", exc_info=e)
except Exception:
logger.exception("Error closing child")
self._child = None
self._child_name = None

View File

@ -225,8 +225,8 @@ class AbstractDeviceNode(RpcNode):
def __call__(self, *args, **kwargs):
try:
return super().__call__(*args, **kwargs)
except (SmartcardException, OSError) as e:
logger.error("Device error", exc_info=e)
except (SmartcardException, OSError):
logger.exception("Device error")
self._child = None
name = self._child_name
self._child_name = None
@ -236,7 +236,7 @@ class AbstractDeviceNode(RpcNode):
try:
return super().create_child(name)
except (SmartcardException, OSError):
logger.error(f"Unable to create child {name}", exc_info=True)
logger.exception(f"Unable to create child {name}")
raise NoSuchNodeException(name)
def get_data(self):
@ -316,7 +316,7 @@ class ConnectionNode(RpcNode):
try:
return super().__call__(*args, **kwargs)
except (SmartcardException, OSError) as e:
logger.error("Connection error", exc_info=e)
logger.exception("Connection error")
raise ChildResetException(f"{e}")
except ApduError as e:
if e.sw == SW.INVALID_INSTRUCTION:
@ -331,8 +331,8 @@ class ConnectionNode(RpcNode):
super().close()
try:
self._connection.close()
except Exception as e:
logger.warning("Error closing connection", exc_info=e)
except Exception:
logger.warning("Error closing connection", exc_info=True)
def get_data(self):
if (