AdvancedClimateSystems / uModbus

Python implementation of the Modbus protocol.
Mozilla Public License 2.0
211 stars 81 forks source link

Convert unknown error codes to a useful exception class. #112

Open acolomb opened 3 years ago

acolomb commented 3 years ago

Introduce an UndefinedModbusException class and use it when the lookup in error_code_to_exception_map fails. Previously that would just throw a KeyError with the contained value, so this change makes it more obvious what actually happened.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.3%) to 95.969% when pulling c3212d6094017aabe6329a52c646cd82f10c41f3 on acolomb:handle-undefined-error-codes into f1128a73e43f565bacedd1ae99d077d7c9c831f3 on AdvancedClimateSystems:master.

acolomb commented 3 years ago

The docstrings for all these exception classes are somewhat inconsistent. If you like, I will include a commit making them PEP-257 compliant.