1
0
mirror of https://github.com/JoelBender/modpypes synced 2025-10-26 21:49:19 +08:00

pass errors upstream

This commit is contained in:
Joel Bender 2016-10-20 16:27:42 -04:00
parent 60678be99f
commit 00537d17dc

View File

@ -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)