uModbus icon indicating copy to clipboard operation
uModbus copied to clipboard

Pass a partially received response in the ValueError exception.

Open acolomb opened this issue 5 years ago • 2 comments

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.

I find the choice of ValueError exception kind of confusing for this type of error, but anything else would break compatibility. So I opted to just add the (partial) response verbatim as an argument. If it is empty, a TimeoutError or similar might be easier to understand?

acolomb avatar Feb 03 '21 08:02 acolomb

Coverage Status

Coverage decreased (-0.1%) to 96.158% when pulling 7522a4fe882f69f2563fce8c2bf56a01aadd67ce on acolomb:pass-partial-response-in-exception into f1128a73e43f565bacedd1ae99d077d7c9c831f3 on AdvancedClimateSystems:master.

coveralls avatar Feb 03 '21 08:02 coveralls

Applied the same treatment to the CRCError class, which is also useful in debugging.

acolomb avatar Mar 03 '21 12:03 acolomb