How to read debug console line?

#1

I'm using node-red-contrib-ab for reading plc data.
When PLC is disconnected it shows "Failure (Bad values)" in debug field as msg: String[20],
i want to read this message so than i can know the plc is offline.
I have tried with debug node but no luck.

any ideas how to do that

0 Likes

#2

I am not sure I fully understand what you are seeing, could you post a screenshot of the error message.

Does a Catch node catch the error?

0 Likes

#3

Note: also asked on Stack Overflow: https://stackoverflow.com/questions/51999057/node-red-catching-error-node-red-contrib-ab

@nsp For the Catch node to work, the node needs to be reporting the errors using the proper API. If you are only getting a log message and nothing from the Catch node, that means the node needs fixing.

However, the node you mention, node-red-contrib-ab has not been updated for 2 years and has no github link associated with it for reporting issues. You would have to contact the author directly to ask if they can make the change.

Alternatively, I see that node is actually an old fork of https://www.npmjs.com/package/node-red-contrib-s7 which is more widely used and actively maintained. You may want to see if you can switch to that module for your particular PLC.

0 Likes

#4

Note: also replied on Stack Overflow:Reply
Thank you, but on the terminal the node prints this message:

[error] [ab endpoint:d9497bf0.558fc8] Failure (Bad values)

is this how the catch node catches error by "[error]" ?

0 Likes

#5

@nsp I'm not going to have this conversation in two places, so if you want to continue beyond this response, either reply here or on SO - not both.

The API docs (which I failed to include a link to here, but did on SO) describes exactly what the node needs to do to log an error for the Catch node to receive it: https://nodered.org/docs/creating-nodes/node-js#handling-errors

0 Likes

#6

Sorry, I missed the link.
Again thanks for your support.

0 Likes