It's possible catch error from configuration node?

Hello,

I'm using the pallete node-red-contrib-s7 to collect data from a PLC. The catch and status node don't work properly with this pallete, because the error is caused from the configuration node of the PLC connection.

Capturar
Capturar2

Someone knows how to get the error from configuration nodes?

Thanks!

It will depend on how the Config node is logging the error.

See this post for details - Catch node not finding error

Thanks @knolleary, I will sugest a issue into the pallet github repository.

Thanks for asking this question. After diving in the code, I have the answer for this. I couldn't find it in the manual, but the mqtt node is useful.

So, what's needed:

Consumer node (eg. mqtt):

  • Register this node on node initialization: node.broker.users[node.id] = node;
  • Deregister this node on close: node.on("close", () => { delete node.broker.users[node.id]; }

Broker node (eg. mqtt-broker):

  • Make sure node.users exists on initialisation: node.users = {};
  • Log errors using two arguments: node.error("msg", {})

Note: node.warn("msg", {}) will not be catchable, only errors.

1 Like

I think they gave you a solution on Github: by changing the s7 configuration node to the pertinent flow, you can use a catch node on that flow to handle the errors. You did not reply to them.

I tested it on my own project (I was having the same issue), and it works well.