diff --git a/modpypes/app.py b/modpypes/app.py index 4a21849..bb55e0d 100644 --- a/modpypes/app.py +++ b/modpypes/app.py @@ -114,6 +114,11 @@ class ModbusClient(Client, Server): """Got a response from the server.""" if _debug: ModbusClient._debug("confirmation %r", pdu) + # pass through errors + if isinstance(pdu, Exception): + self.response(pdu) + return + # generic decode mpdu = MPDU() mpdu.decode(pdu) @@ -158,6 +163,11 @@ class ModbusServer(Client, Server): """This is a request from a client.""" if _debug: ModbusServer._debug("confirmation %r", pdu) + # pass through errors + if isinstance(pdu, Exception): + self.response(pdu) + return + # generic decoding mpdu = MPDU() mpdu.decode(pdu)