From fd83ee23e1d7f72e493038455b99ea70320a5f5c Mon Sep 17 00:00:00 2001 From: atse Date: Tue, 11 Jul 2023 17:45:57 +0800 Subject: [PATCH] Catch a more specific exception --- pytec/tec_qt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 7956b88..4fd3ff5 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -199,7 +199,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.tec_client = None self._on_connection_changed(False) - except Exception as e: + except (OSError, TimeoutError) as e: logging.error(f"Failed communicating to {ip}:{port}: {e}") await self.tec_client.disconnect() self._on_connection_changed(False)