Errors, CATCH and finding the error. Not good

Hello again.

I am not wanting to be the squeaky wheel and am not posting to get attention.

As many of you know I am kind of out of my depth with JavaScript but am playing with NR a fair bit.

Originally I didn't bother with the CATCH node, as I didn't fully understand what it did and/or how it worked.

When an error happened, I would see the error message and usually I would be able to find the node by clicking on the node name in the list to the right of the screen - the debug list.
That would take me to the flow and the node. Or close enough that if I hovered the mouse over the error message and I looked at the screen, I would see a node get the dotted red line around it.

As I have 7 remote machines that became tyre-some and not always "practical".

I dug and improved my knowledge of the CATCH node.
So what I did on every flow was put the CATCH node - code here to simplify:

[{"id":"26b3f31b.50592c","type":"catch","z":"e2bd5a4e.5597e8","name":"","scope":null,"x":100,"y":920,"wires":[["1e133465.cafdfc"]]},{"id":"1e133465.cafdfc","type":"function","z":"e2bd5a4e.5597e8","name":"Name flow","func":"msg.topic = \"Local Readings flow\";\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":920,"wires":[["ee53c140.405fe"]]},{"id":"3d5c3740.987da","type":"link in","z":"e2bd5a4e.5597e8","name":"ERROR RX","links":["1c6673bc.57897c","d8c75897.7610b","7e15b07e.eb6dd","6b0e8cc6.3f834c","fa5f1a1d.fe183","deb8cf5e.c79808","5d18e796.f6a298","90075991.04c27","118ad88b.ef1077","560ff4f0.8e9664","83436254.42b62","e963463e.8cf3b8","6bce9b2f.0d9fb4","8b2f6257.d125b8"],"x":275,"y":970,"wires":[["ee53c140.405fe","405e47a7.7964c"]]},{"id":"ee53c140.405fe","type":"change","z":"e2bd5a4e.5597e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"error","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":920,"wires":[["c54da91.56dae58"]]},{"id":"c54da91.56dae58","type":"function","z":"e2bd5a4e.5597e8","name":"Set topic","func":"var device_name =global.get('myDeviceName');\nmsg.topic =\"ERROR_REPORT/\" + device_name + \"/\" + msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":920,"wires":[["b9382cba.6b5748","ace59945.3ca778"]]},{"id":"b9382cba.6b5748","type":"mqtt out","z":"e2bd5a4e.5597e8","name":"ERROR_REPORT","topic":"","qos":"","retain":"","broker":"964d7beb.f4f8b","x":850,"y":920,"wires":[]},{"id":"ace59945.3ca778","type":"debug","z":"e2bd5a4e.5597e8","name":"Local Readings error message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":970,"wires":[]},{"id":"405e47a7.7964c","type":"debug","z":"e2bd5a4e.5597e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":480,"y":1030,"wires":[]},{"id":"964d7beb.f4f8b","type":"mqtt-broker","z":"","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"20","cleansession":true,"birthTopic":"SOM","birthQos":"2","birthPayload":"'Awaiting Music Pi'","willTopic":"EOM","willQos":"2","willPayload":"'MusicPi telemetry failure'"}]

And a smaller version on each of the flows that send back basically what the first two nodes to on that flow (via the link) to that main flow.

Ok, it has problems in there - somewhere (probably) - but the idea is there.
I thought this would be good, as then, on ONE machine: if I get any errors, it would tell me the machine and the flow.

Yes it does, but then it all falls apart for me.
WHICH node? I know there is a NODE-ID in there. But to make it human readable?

So what I did was remove all the CATCH nodes and hope to go back to seeing errors, hovering over the message and the node is circled by a red line.

That no-longer seems to be happening. AND, say I am looking at the flow which made the error, if I click on the node-id the screen jumps (scrolls) to...... anywhere at random. Even a completely blank screen. (Eg: If the flow is in the top left of the work area, I am looking at the bottom right.)

This is annoying and frustrating.

Has anyone else seen this?

I am open to ideas of how to deal with errors so there is ONE machine which gets the error reports and exclusively has them in a separate list for me to look at but to date it eludes me how to do this.

Thanks in advance.

Do you know that you can use the "Search flows" menu to find a specific node by its ID? So if clicking on the node id in the debug sidebar doesn't take you to the right node, try taking the node id from the error ad paste it into the search.

1 Like

I didn't equate the search to that.

Thanks.

Shall try to remember next time I get an error to use it.

Not 100% sure, but I have tried it when not looking for errors, but searching for the other end of the LINK pairing.

I enter the name of the other end of the link in the search and see it. Click on it and get sent to "the back of no where".

Shall have to check again a few more times.

No complaining, but it seems to not be working.
When I get more tests done and more supporting events I'll add more here.
(as new post)

There is an easy way of doing that. If you click on the link node itself then it shows the linked nodes as dotted grey outlines. You can then click on the dotted node to go to it.

1 Like

Thanks.

I knew if I clicked on the link it showed the link to any nodes on that ..... page.

I didn't know if you clicked on the line, it took me to the other end.

Shame you can't do that with links on other pages.

I just tried what you said with a link on the same page.

Clicked on the NODE, and saw the dotted line. It goes off screen (no problems) and as soon as I move the mouse to the dotted line and click...... The line disappears and I am not take to the other end of the link.

It works to links on other pages too, but you should click on the grey node, not on the line.

That doesn't work.

As soon as I click on the line, the highlited LINK NODE is de-selected and the line goes away.

For nodes on other pages:
Well, yeah, kind of.
All that does is show you a link with the page names.
Though better than nothing, FINDING the node on said other page can be annoying.
Granted there is the SEARCH FLOW option.

But I have mentioned that it too sometimes sends to to "the middle of nowhere" when I click on a selection.

Read what I said. On the end of the dotted line it shows the node(s) at the other end of the link. Click on the node not the line.
[Edit]
Actually that is not quite right, it doesn't show the nodes it shows the tab names looking a bit like nodes, but click on the name and it takes you to the linked node on that tab

1 Like

Sorry.....

This is confusing. (And probably MY fault)

I have a LINK NODE.

If it stays on the same "page" there is no quick easy way to get to the other end.
Not a big deal. As the dotted line shows you where it is.

I mentioned that when I open the SEARCH FLOW and enter a NODE's name, and click on that, I am SOMETIMES taken to "the back of no-where". ie: A blank part of a flow.

This is frustrating to me as I don't understand why this is happening.

Thanks.

What you explained does help a bit.

Click on the link node then click where it shows the tab name (in this case Handle Messages). If that doesn't make sense post a shot of what you see when you click the link node.

Screenshot-2018-08-18-10%3A19%3A19

@Trying_to_learn has that helped?

Sorry for long delay in replying.

Yes it did help in some ways.

Do you mean that clicking it took you to the other end of the link?

Sorry - had the flu'.

It helps me with finding the other end of a cross page link.

I haven't 100% done it and got 100% results because I have been a bit "off line" the last few days.

If anyone is still looking at this thread:

New information:

This is some code I have in my flows:

[{"id":"90075991.04c27","type":"link out","z":"381d953d.4cf092","name":"MC error TX","links":["8488af57.1a91e8","3d5c3740.987da"],"x":2275,"y":150,"wires":[]},{"id":"e56285b1.fe7ff","type":"function","z":"381d953d.4cf092","name":"Name flow","func":"msg.topic = \"MC flow\";\nreturn msg;","outputs":1,"noerr":0,"x":2170,"y":150,"wires":[["90075991.04c27"]]},{"id":"8297d057.b5ef98","type":"debug","z":"381d953d.4cf092","name":"Master Control error message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":2230,"y":190,"wires":[]},{"id":"40abdd07.f5fb44","type":"catch","z":"381d953d.4cf092","name":"","scope":null,"x":2000,"y":150,"wires":[["e56285b1.fe7ff","8297d057.b5ef98"]]}]

and on the main flow:

[{"id":"b9382cba.6b5748","type":"mqtt out","z":"e2bd5a4e.5597e8","name":"ERROR_REPORT","topic":"","qos":"","retain":"","broker":"964d7beb.f4f8b","x":850,"y":920,"wires":[]},{"id":"c54da91.56dae58","type":"function","z":"e2bd5a4e.5597e8","name":"Set topic","func":"var device_name =global.get('myDeviceName');\nmsg.topic =\"ERROR_REPORT/\" + device_name + \"/\" + msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":920,"wires":[["b9382cba.6b5748","ace59945.3ca778"]]},{"id":"ace59945.3ca778","type":"debug","z":"e2bd5a4e.5597e8","name":"Local Readings error message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":970,"wires":[]},{"id":"3d5c3740.987da","type":"link in","z":"e2bd5a4e.5597e8","name":"ERROR RX","links":["1c6673bc.57897c","d8c75897.7610b","7e15b07e.eb6dd","6b0e8cc6.3f834c","fa5f1a1d.fe183","deb8cf5e.c79808","5d18e796.f6a298","90075991.04c27","118ad88b.ef1077","560ff4f0.8e9664","83436254.42b62","e963463e.8cf3b8","6bce9b2f.0d9fb4","8b2f6257.d125b8","84e45829.d6ce18","59757683.33e26","a9689d46.db93f8","d8c7ba51.43a79","aaa892e1.ab63e8","ea7ffb01.89e39"],"x":275,"y":970,"wires":[["ee53c140.405fe","405e47a7.7964c"]]},{"id":"ee53c140.405fe","type":"change","z":"e2bd5a4e.5597e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"error","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":920,"wires":[["c54da91.56dae58"]]},{"id":"405e47a7.7964c","type":"debug","z":"e2bd5a4e.5597e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":480,"y":970,"wires":[]},{"id":"1e133465.cafdfc","type":"function","z":"e2bd5a4e.5597e8","name":"Name flow","func":"msg.topic = \"Local Readings flow\";\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":920,"wires":[["ee53c140.405fe"]]},{"id":"26b3f31b.50592c","type":"catch","z":"e2bd5a4e.5597e8","name":"","scope":null,"x":100,"y":920,"wires":[["1e133465.cafdfc"]]},{"id":"964d7beb.f4f8b","type":"mqtt-broker","z":"","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"20","cleansession":true,"birthTopic":"SOM","birthQos":"2","birthPayload":"'Awaiting Music Pi'","willTopic":"EOM","willQos":"2","willPayload":"'MusicPi telemetry failure'"}]

That sends off a message with a topic of which machine and which flow the error was on.

I get this message:

{"topic":"ERROR_REPORT/TimePi/MC flow","payload":"{\"message\":\"TypeError: Cannot read property 'length' of undefined\",\"source\":{\"id\":\"75e428e9.b87b5\",\"type\":\"function\",\"name\":\"\",\"count\":1}}","qos":0,"retain":false,"_msgid":"e9c45731.bc2a68"}

So I am guessing that this node is the one with the error:
75e428e9.b87b5

Ok, so I enter than in the SEARCH FLOW and see this:
(See attached)
Screenshot%20from%202018-08-29%2020-50-32

You can see the error report and I enter the node name.

I see the result for the search and it points to the "Master Control" flow.
You can't see it but I am on that tab in the browser.

Then I click on it....
(See attached)
I get taken to "the middle of no where" - as shown by the two red rectangles around the scroll bars.

It is NOT (as far as I can see) taking me to that node.
Screenshot%20from%202018-08-29%2020-50-40

Could someone help me understand what I am doing wrong?

Is it possible that the browser view is not up to date? Refresh the view in the browser and try the search again.
Otherwise I don't know why clicking it doesn't take you to the node, but to get round the problem if you give your function nodes names then that should help, as you would be able to see the name.
Alternatively if you look at your flows file in a text editor you can search for the id and find the function node, then you will probably recognise the code in the function.

1 Like

Colin,

I do appreciate that it is good programming to give nodes/functions names.

Alas sometimes when you are "on a roll" (though this would negate this truth) you get things done and forget to do just that.

So in the future it bites you.

When you say refresh the view, do you mean press the refresh button?

I'll try it and report back.

Interesting.

That worked.

I get that the browser may need to be updated because of any changes I have (since?) done.
But the node was OLD (I think a guy called Noah helped me with it) and it hadn't been edited/changed any time recently and I had DEPLOYED the flow a few times since then.

Why would it not find it until I refreshed the browser then?
(semi-rhetorical)

Possibly you had multiple tabs open with the same view and switched to a different tab. When you refreshed and then clicked in the search did it go to the same area of the flow and now the node was there or did it go to a different area, or possibly the node is the function node that was visible but it just hadn't highlighted it the first time? Either way if the view on screen is not what the server has then all bets are off.
I am assuming that you haven't been editing on more than one PC.
I have occasionally seen browsers go back to a cached image when the browser or PC is restarted, instead of fetching the latest, so that is another possibility.

Luckily only on one.

The node was on a different part of the screen to what the capture I sent.

I guess I will have to chalk it to up "bad luck on my side".

It is I am seeing a few of these kind of things happening which only complicates my position.
(shrug)
These "Unassigned nodes. Click here to fix the problem" keeps happening time and time too.
But that's another (dead) thread.