Catch a more specific exception

This commit is contained in:
atse 2023-07-11 17:45:57 +08:00
parent 115c7eb800
commit fd83ee23e1
1 changed files with 1 additions and 1 deletions

View File

@ -199,7 +199,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.tec_client = None self.tec_client = None
self._on_connection_changed(False) self._on_connection_changed(False)
except Exception as e: except (OSError, TimeoutError) as e:
logging.error(f"Failed communicating to {ip}:{port}: {e}") logging.error(f"Failed communicating to {ip}:{port}: {e}")
await self.tec_client.disconnect() await self.tec_client.disconnect()
self._on_connection_changed(False) self._on_connection_changed(False)