Error catching and a function node to indicate errors

Yes, I know I have been down here before.

I have since discovered the function of the "CATCH ALL" node.

So, to try and help myself on what is going on, I thought I would add a bit of extra stuff on that part of the flow.

[{"id":"e35ce20a.0fecd8","type":"catch","z":"b04360a6.da324","name":"","scope":null,"x":110,"y":1190,"wires":[["c31406ad.87dfa8","e237ff3a.70315"]]},{"id":"e237ff3a.70315","type":"function","z":"b04360a6.da324","name":"Name flow","func":"msg.topic = \"Logging flow\";\nnode.status({fill:\"red\",shape:\"dot\",text:\"ERROR\"});\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":1190,"wires":[["6bce9b2f.0d9fb4"]]}]

The FUNCTION node also sets a RED marker if that node sees an error.

I'm guessing a FULL DEPLOY would reset it?
(No it doesn't)
The node is set to a red indicator. I've looked at the error. How do I remove the indicator?
If not that easy I may just not put the line in the node.

you’ve done if and else statements before.

If you see an error draw a red dot
else draw a green square

Here is an example showing a way to set/clear the status,

1 Like

I believe that a full deploy should reset it. Put a debug node on the output of the Catch and see if you are getting an error immediately on deploy.

UKMoose,

Yes, I have done (and had fun with) IF ELSE statements.

But the part that has/had me stuck was that as far as I can see, the output is only there if an error has happened.

So if there isn't an error, there is no output. Anyway, I'll look at the example from zenofmud.

Zenofmud,

Thanks.

I hadn't got that far with the catchall node.

Colin,

I may have been wrong in a FULL deploy doesn't clear it.

I mostly do modified nodes only. Sometimes a FULL.

I may have got the settings wrong when I posted it.

Oops.

Take a look at the trigger node, that can send a second message after the first message comes in.
So for example if theres an error, 20 seconds after the error a second message is sent with a different msg that then allows you to do your IF ELSE statement to reset the marker

Thanks.

I installed the "DSM" node and ran the flow.

When I press the error injection node, I get an error (not as per the expected error)
"Unexpected token b in JSON at position 8"

Ok, let me explain.

I loaded your flow.

I press the "ERROR" injection and I expect an error.

But not an ERROR.

What do I mean?

Well, I am expecting a "legitimate" error to be made.

But rather under the DSM I get an error saying that message about the unexpected token b in JSON at position 8.

Looking at the error node and the ok node, I am suspicious that the error would be more to do with foo and bar.

Not "unexpected token......"

As I don't talk the talk, I am unsure if that is an honest mistake when you wrote the code or what.

So I am no further down the understanding path than I was.

Sorry.

I'll read your reply again.
Just in the mean time I seem to have killed my remote (main) NR machine and am suffering severe sinus problems.