Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pymodbus/server/requesthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ async def handle_request(self):
if self.server.ignore_missing_devices:
return # the client will simply timeout waiting for a response
response = ExceptionResponse(self.last_pdu.function_code, ExceptionResponse.GATEWAY_NO_RESPONSE)
except KeyError:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not generic, problems in the sparse datastore, should be solved at that level.

keyError can probably mean different things in the different datastores.

Look at simulator.py around line 587, to see how it is handled there (apart from the ugly constant 2).

Log.error("Requested register address does not exist: {}", self.last_pdu.address)
response = ExceptionResponse(self.last_pdu.function_code, ExceptionResponse.ILLEGAL_ADDRESS)
except Exception as exc: # pylint: disable=broad-except
Log.error(
"Datastore unable to fulfill request: {}; {}",
Expand Down