Skip to content

Commit

Permalink
Pass a partially received response in the ValueError exception.
Browse files Browse the repository at this point in the history
Allow better debugging when an incomplete response was received or
timed out.  The already received part (empty on timeout) is passed as
the first and only argument in the ValueError exception, accessible as
e.args[0] in a handler.
  • Loading branch information
acolomb committed Feb 3, 2021
1 parent f1128a7 commit 5c02a1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion umodbus/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@ def recv_exactly(recv_fn, size):
response = b''.join(chunks)

if len(response) != size:
raise ValueError
raise ValueError(response)

return response

0 comments on commit 5c02a1a

Please sign in to comment.