modbus_lib
modbus_lib copied to clipboard
Unify error handling procedure
Currently two different error management approaches are used. One uses return modbus_lib_send_error(MBUS_RESPONSE_SERVICE_DEVICE_FAILURE) and other uses return MBUS_RESPONSE_SERVICE_DEVICE_FAILURE in modbus_lib_read_handler and modbus_lib_write_handler respectively.
Proper approach might be using modbus_lib_send_error() for both of them (reverse the #4 changes) or create a relevant error function for each error code in order to get rid of writing modbus_lib_send_error, which will become:
return MBUS_RESPONSE_SERVICE_DEVICE_FAILURE();