From 2967845d28ff016c14bbb9d288c5ddcdf96158e7 Mon Sep 17 00:00:00 2001 From: luojiaaoo <675925864@qq.com> Date: Sun, 29 Jun 2025 00:15:13 +0800 Subject: [PATCH 1/3] udsoncan except TimeoutException that is internal definition, but doipclient raise std err TimeoutError --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index a9990ac..ec3e4ef 100644 --- a/README.rst +++ b/README.rst @@ -38,6 +38,7 @@ using pytest:: Example ------- Updated version of udsoncan's example using `python_doip` instead of IsoTPSocketConnection +if you want to use `suppress_positive_response=True`, please change `except TimeoutException:` to `except (TimeoutException, TimeoutError):` in `def send_request` of file `udsoncan/client.py` .. code-block:: python From 970d986739cb25aa9a02ade49c671d766421ef31 Mon Sep 17 00:00:00 2001 From: luojiaaoo <675925864@qq.com> Date: Mon, 30 Jun 2025 22:26:29 +0800 Subject: [PATCH 2/3] catch Timeout error in the doipclient adapter class --- README.rst | 3 +-- doipclient/connectors.py | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index ec3e4ef..2c74bfa 100644 --- a/README.rst +++ b/README.rst @@ -37,8 +37,7 @@ using pytest:: Example ------- -Updated version of udsoncan's example using `python_doip` instead of IsoTPSocketConnection -if you want to use `suppress_positive_response=True`, please change `except TimeoutException:` to `except (TimeoutException, TimeoutError):` in `def send_request` of file `udsoncan/client.py` +Updated version of udsoncan's example using `python_doip` instead of IsoTPSocketConnection .. code-block:: python diff --git a/doipclient/connectors.py b/doipclient/connectors.py index a9778a1..a48b557 100644 --- a/doipclient/connectors.py +++ b/doipclient/connectors.py @@ -1,4 +1,5 @@ from udsoncan.connections import BaseConnection +from udsoncan.exceptions import TimeoutException class DoIPClientUDSConnector(BaseConnection): @@ -43,7 +44,11 @@ def specific_send(self, payload): self._connection.send_diagnostic(bytearray(payload)) def specific_wait_frame(self, timeout=2): - return bytes(self._connection.receive_diagnostic(timeout=timeout)) + try: + return bytes(self._connection.receive_diagnostic(timeout=timeout)) + except TimeoutError as e: + raise TimeoutException(str(e)) from e + def empty_rxqueue(self): self._connection.empty_rxqueue() From 997958f75852c778bfb8376507224effac88dac1 Mon Sep 17 00:00:00 2001 From: luojiaaoo <675925864@qq.com> Date: Mon, 30 Jun 2025 22:29:07 +0800 Subject: [PATCH 3/3] delete excessive spaces --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2c74bfa..a9990ac 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ using pytest:: Example ------- -Updated version of udsoncan's example using `python_doip` instead of IsoTPSocketConnection +Updated version of udsoncan's example using `python_doip` instead of IsoTPSocketConnection .. code-block:: python