Skip to content

Commit 007568f

Browse files
johnmikojaniversen
authored andcommitted
Add connection exception to list of exceptions catpured in retries (#2113)
1 parent 9a4308c commit 007568f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymodbus/transaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from threading import RLock
1919

2020
from pymodbus.exceptions import (
21+
ConnectionException,
2122
InvalidMessageReceivedException,
2223
ModbusIOException,
2324
)
@@ -325,7 +326,7 @@ def _transact(self, packet, response_length, full=False, broadcast=False):
325326
result = self._recv(response_length, full)
326327
# result2 = self._recv(response_length, full)
327328
Log.debug("RECV: {}", result, ":hex")
328-
except (OSError, ModbusIOException, InvalidMessageReceivedException) as msg:
329+
except (OSError, ModbusIOException, InvalidMessageReceivedException, ConnectionException) as msg:
329330
self.client.close()
330331
Log.debug("Transaction failed. ({}) ", msg)
331332
last_exception = msg

0 commit comments

Comments
 (0)