Replace formatting socket.error by exc_info in network.udp

This commit is contained in:
Dmitri Bogomolov 2021-01-27 21:40:38 +02:00
parent 8ff8e0e2cb
commit 6168d63699
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -125,9 +125,9 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
def handle_read(self):
try:
(recdata, addr) = self.socket.recvfrom(self._buf_len)
except socket.error as e:
logger.error("socket error: %s", e)
recdata, addr = self.socket.recvfrom(self._buf_len)
except socket.error:
logger.error("socket error on recvfrom:", exc_info=True)
return
self.destination = Peer(*addr)
@ -143,7 +143,7 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
try:
retval = self.socket.sendto(
self.write_buf, ('<broadcast>', self.port))
except socket.error as e:
logger.error("socket error on sendto: %s", e)
except socket.error:
logger.error("socket error on sendto:", exc_info=True)
retval = len(self.write_buf)
self.slice_write_buf(retval)