asyncio.TimeoutError not needed

This commit is contained in:
atse 2024-01-09 12:20:58 +08:00
parent 3b13881429
commit 0e5d7ee9fb

View File

@ -78,7 +78,7 @@ class WrappedClient(QObject, Client):
async def _read_line(self): async def _read_line(self):
try: try:
return await super()._read_line() return await super()._read_line()
except (OSError, TimeoutError, asyncio.TimeoutError) as e: # TODO: Remove asyncio.TimeoutError in Python 3.11 except (OSError, TimeoutError) as e:
logging.error("Client connection error, disconnecting", exc_info=True) logging.error("Client connection error, disconnecting", exc_info=True)
self.connection_error.emit() self.connection_error.emit()
@ -687,7 +687,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
else: else:
await self.bail() await self.bail()
except (OSError, TimeoutError, asyncio.TimeoutError) as e: # TODO: Remove asyncio.TimeoutError in Python 3.11 except (OSError, TimeoutError) as e:
logging.error(f"Failed communicating to {host}:{port}: {e}") logging.error(f"Failed communicating to {host}:{port}: {e}")
await self.bail() await self.bail()