I have to implement a flow where if node-red-copntrib-modbus cannot connect to a MOXA device, then I need to interrupt the flow execution and send back a http failure result.
So far, I couldn't reach the point, in case if I am setting an invalid IP, which of course unreachable, the nodes stuck in initialize state forever, and the catch node didn't log anything in my test flow.
As you can see, it's in initialize state, but on the debug window you can see the status is green. Based on the debug logs, even if I can see yellow and initialize on the screen, and it's not changing, the last status reported by the status node is always green. I guess in one point of time it will change, and maybe then it will follow the actual state, but till that it's not works properly.
Did you also experienced this issue, or I set something incorrectly?
Is there any more advanced way to handle it?
A more reliable way of catching errors with the Modbus nodes (instead of using Status or Catch nodes)
is by enabling the option "Empty msg on Modbus Fail" on the Modbus Flex Getter.
In case of a failure this will produce a msg with a property error and empty payload
that you can then look for and handle appropriately.