Skip to content

Commit 9505df1

Browse files
authored
Use TimeoutException for the udsoncan connector instead of TimeoutError (#59)
udsoncan expects Connections to raise TimeoutException. Doipclient raises TimeoutError in all cases previously. Wrap the error.
1 parent 67b36e6 commit 9505df1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doipclient/connectors.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from udsoncan.connections import BaseConnection
2+
from udsoncan.exceptions import TimeoutException
23

34

45
class DoIPClientUDSConnector(BaseConnection):
@@ -43,7 +44,11 @@ def specific_send(self, payload):
4344
self._connection.send_diagnostic(bytearray(payload))
4445

4546
def specific_wait_frame(self, timeout=2):
46-
return bytes(self._connection.receive_diagnostic(timeout=timeout))
47+
try:
48+
return bytes(self._connection.receive_diagnostic(timeout=timeout))
49+
except TimeoutError as e:
50+
raise TimeoutException(str(e)) from e
51+
4752

4853
def empty_rxqueue(self):
4954
self._connection.empty_rxqueue()

0 commit comments

Comments
 (0)