Apollo3zehn / FluentModbus

Lightweight and fast client and server implementation of the Modbus protocol (TCP/RTU).
MIT License
211 stars 72 forks source link

Fixed exception for malformed messages #101

Closed lmartorella closed 7 months ago

lmartorella commented 11 months ago

Fixed ArgumentOutOfRangeException exception in case of malformed messages, shorter than 2 bytes. Since the check for malformed messages is already in place, with this fix we can avoid unexpected exceptions. Thx, L!

lmartorella commented 10 months ago

Added another case of "ArgumentOutOfRangeException" raise in case the modbus error received is custom and not one of the predefined ones. For uniformity of API, it should be correct to raise the same exception type "ModbusException" also for such cases, with a generic error message.

Apollo3zehn commented 7 months ago

Thanks for your contribution and sorry for being so late