mirror of
https://github.com/JoelBender/modpypes
synced 2025-10-26 21:49:19 +08:00
pass errors upstream
This commit is contained in:
parent
60678be99f
commit
00537d17dc
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user