node-red-contrib-opcua icon indicating copy to clipboard operation
node-red-contrib-opcua copied to clipboard

Handle Errors / no status

Open Test012345678949 opened this issue 1 year ago • 13 comments

Hi,

maybe I can't see the solution but how can I handle if there are no items in the opcua client for multiple reading:

grafik

The Error which is thrown is not catchable I think and no bedug messages is sent and the status isn't changed too.

If the error is catchable or the status will change to "Error Nr 123" I can handle an injections of items and the flow would be fail save or am I on the wrong way ??

Greetings

Test012345678949 avatar Feb 22 '24 11:02 Test012345678949

Hmm, latest client node has two output. Second one is for the errors. Test again with the latest version, please.

mikakaraila avatar Feb 22 '24 12:02 mikakaraila

Thx for your immediate reply.

Youre right the latest version has 2 outputs, but the "No Items Error" doesn't start a message either:

grafik

Test012345678949 avatar Feb 22 '24 13:02 Test012345678949

Ok,

I looked at the source: in Line 1507 of 102-opcuaclient.js the problem is handled:

        if (multipleItems.length === 0) {
          node_error(node.name + " no items to read");
          return;

If there is a

    if (multipleItems.length === 0) {
      node_error(node.name + " no items to read");
      set_node_status_to("No items to read");
      return;

Then it could be handled by the "status" node

I think it should be a design question: Make unhandeled erros --> Errors on the second output and kill all "node_errors" in the code which are "normal errors" or bring the errors to the node "status" and make them catchable by the status node

Test012345678949 avatar Feb 23 '24 12:02 Test012345678949

Ack, I will fix this to next release and check other places at the same time.

Just one extra comment: if you clear items then you should not try to read anything as there is no items to read...

At least same with write multiple items.

mikakaraila avatar Feb 26 '24 08:02 mikakaraila

Thx.

Yes normally I would say "That's right", but in the flow "programming" I have two or three times seen, that the OPCUA has no item's without been cleared. I think this is from partially restarting the flow.

To solve this issue permanent, my idea was: If no items are there --> add them and start the reading some seconds later.

Therefore the message "No items" has to be readable by the flow.

Or am I wrong ??

Test012345678949 avatar Feb 26 '24 09:02 Test012345678949

OK, this clarifies problem for me. I will be travelling this week. So most probably I will have time next week to fix & test this.

mikakaraila avatar Feb 26 '24 09:02 mikakaraila

No problem.... You make great work and it runs stable and flawless.

I'm really happy for your short time reaction and therefore it is no problem waiting 1 week.

Test012345678949 avatar Feb 26 '24 09:02 Test012345678949

I found some other similar cases and fixed other set status cases.

I will do some testing before publishing new version...

mikakaraila avatar Feb 26 '24 14:02 mikakaraila

Hi, Do you know, when a new version will be published ???

Test012345678949 avatar Apr 12 '24 06:04 Test012345678949

Thanks to remind me. Have been busy and bit sick.

mikakaraila avatar Apr 12 '24 08:04 mikakaraila

Thx for the direct reply.

Get well soon, and I hope your not too sick ?? My children often bring some strange things home.

Test012345678949 avatar Apr 12 '24 08:04 Test012345678949

I just made & published new version. Not fully tested, so I will fix if there is something...

mikakaraila avatar Apr 12 '24 10:04 mikakaraila

It runs good.

If status = no items to read --> add items --> start 5 s later new read.

I think there will be no bug within deploying and getting the itemlist cleared, cause then it automatically add the items after the error occurs

Thx

Test012345678949 avatar Apr 12 '24 11:04 Test012345678949

I will close this now...

mikakaraila avatar Apr 26 '24 11:04 mikakaraila