Skip to content

Commit 6268e3d

Browse files
authored
Add request fc to exceptionResponse. (#2694)
1 parent e68ed2a commit 6268e3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pymodbus/server/requesthandler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ async def handle_request(self):
104104
Log.error("requested device id does not exist: {}", self.last_pdu.dev_id)
105105
if self.server.ignore_missing_devices:
106106
return # the client will simply timeout waiting for a response
107-
response = ExceptionResponse(0x00, ExceptionResponse.GATEWAY_NO_RESPONSE)
107+
response = ExceptionResponse(self.last_pdu.function_code, ExceptionResponse.GATEWAY_NO_RESPONSE)
108108
except Exception as exc: # pylint: disable=broad-except
109109
Log.error(
110110
"Datastore unable to fulfill request: {}; {}",
111111
exc,
112112
traceback.format_exc(),
113113
)
114-
response = ExceptionResponse(0x00, ExceptionResponse.DEVICE_FAILURE)
114+
response = ExceptionResponse(self.last_pdu.function_code, ExceptionResponse.DEVICE_FAILURE)
115115
# no response when broadcasting
116116
if not broadcast:
117117
response.transaction_id = self.last_pdu.transaction_id

0 commit comments

Comments
 (0)