Catch Error Node Question

I'm using node-red-contrib-pccc, allen bradley PLC Communication node. I have been working and testing with the contributors. I think we have a resolution to a larger problem that was keeping the system from responding once an error occurred. Errors still do occur, and then when detected, the programming will reset the problem. The error is logged in the "Debug Pane". The error is logged and is referenced to the "Configuration Node"... It seems the Catch Error Node will only respond to errors on that flow tab. Since that is the case, how can I "write" logic in Node-RED to respond to errors that come from "Configuration Nodes" related to the nodes on a PLC Read or Write node? Again, these errors are caught by and displayed on the right side "Debug Pane".

I ran into a similar situation with config nodes this week. Not with the catch node, but the status node.

Currently config nodes cannot be targeted by either of these directly, only the user nodes in the flows. So we have no means to trigger a separate flow on status changes or errors in config nodes.

I have already prepared a feature request for this "status" problem (yet unpublished here). Maybe we can catch two birds with one stone here, as the problems is a similar one.

But I think the developers are rather busy at the moment with the coming v1.0 release. :nerd_face:

The Status issue is completely unrelated - lets not derail this topic.

@hp_apcc the Catch node will only handle errors that have been logged 'properly'. If the node simply calls node.error("my message"); then that will appear in the sidebar and log, but it will not trigger a Catch node.

To trigger a Catch node, the call to node.error() must also provide the message that triggered the error - node.error("my message", msg).

If you search through the src of the pccc node - - you can see it only ever provides an error string to the node.error() call., it never provides the second argument so it will not trigger the Catch node.

The node would need to be updated for you to be able to handle those errors with the Catch node.

1 Like

The config node it's self knows which node is requesting data and so upon error can feedback to the caller node who can issue the node.error.
However, for random disconnections etc, in my nodes (similar omron fins and mitsubishi MC protocol) what I've had to do is emit status to ALL the nodes and I use node.status to indicate errors / disconnection etc.

I do believe there needs to be a means to "act" by reference to the configuation and status nodes. The work on the PLC related nodes probably needs work to make it better. For now, at least I can continue with the logic after a data failure. However, The system won't know that it needs to be re-scanned to update missing data or timing problems.

Kind Regards,

I fell into that one too.

Config nodes can (and do) send errors to be caught by catch node if the msg param is provided

Of course, you are right. Sorry for hijacking this thread. :slightly_smiling_face:

I managed to work around that limitation with a little custom node for now. I can post the feature request on a new thread, if you like.

@knolleary, Thank you for this insight. I will forward your comment to the developers to include this functionality.

Kind Regrds,


@kuema, YES, please post your comments and reference to your custom node. I'm interested in the means to address this kind of thing with possibly other nodes which have limitations and may need this kind of work-around.

That custom node only addresses the status issue. Just something quickly hacked together, so I can receive status events from config nodes.

It's on my machine at work, so I can't access it right away. :see_no_evil:

Dumb question:

You say you want the program to continue after an error. Or more correctly from your post:
Errors still do occur, and then when detected, the programming will reset the problem

Err, that depends on what the error is.

I am playing with error trapping myself. It is fun.

Are these errors in Node-Red or the PLC?

Seeing you are talking about the errors being logged in the debug pane I am taking it as read that it is Node-Red.

I have a general purpose error catching routine/flow I can post if you want.
It is by no means perfect and has a few foreign nodes in it.

But it could help you a bit.

Just offering.
Oh, and there are a few levels to the error catching.
There is flow, machine, sending receiving and displaying.

The first two may be enough to help you for now.

The communications to/from Node-RED is halted at the point of the error. The thinking is that there are dropped TCP packets. This is not a PLC error... It's an error detected by the core PLC Communications programming. The communication, or value exchange, either writing, or reading a "tag". Therefore is most likely not complete. There needs to be a programmatic exchange in order for the program (you wrote) to act on the error, either by re-sending the value being sent... or re-reading the value being updated. The fact the error is on the debug pane is irrelevant to any program running at night, or non-monitored. The program should be able to react to events, and errors are events. The problem that I am having is that the errors are not exposed to the nodes on the flow tab. The error is exposed only to the configuration node... only, which is not in the program environment space. If they were, I could easily program a response to re-send, or re-read the node affected. @knolleary says in this chain, here, the proper syntax is necessary in order to expose the error to the flow tab/page in order for the Catch Error node to work.

It sounds complicated. But I have also learnt that if it wasn't complicated, it wouldn't be fun.

Good luck with it. Seriously.

From what you wrote, it is probably above my skill set.