Ok, at the beginning I was silly. I didn't get all the quirks with MQTT and msg.error.
I think I have moved forward from there but "it" still doesn't seem to be working.
Though the long way, I'll start with knowns and work towards the error.
That way it may help you see how I am confused rather than me post the real order in which things happened.
So:
To generate an error I have this:
[{"id":"cf90dcaa.cb5a1","type":"inject","z":"98cfac7a.d84cf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1220,"y":740,"wires":[["28da7698.4e18d2"]]},{"id":"28da7698.4e18d2","type":"function","z":"98cfac7a.d84cf8","name":"","func":"j = index.of(blah);\nreturn msg;","outputs":1,"noerr":0,"x":1400,"y":740,"wires":[[]]}]
It makes a nice:
"ReferenceError: index is not defined (line 1, col 5)"
Error in the DEBUG window.
That is in a flow with no CATCH node.
I have this code on any needed flows to catch any errors and report them back.
Yes, some nodes need editing to give the correct names. Thought I should declare that.
So, the nodes have the right names.
[{"id":"ae688514.9c35a","type":"comment","z":"98cfac7a.d84cf8","name":"Error catching","info":"","x":130,"y":880,"wires":[]},{"id":"c542bea1.39266","type":"catch","z":"98cfac7a.d84cf8","name":"","scope":null,"x":130,"y":920,"wires":[["d08624b3.de1ca8"]]},{"id":"19adcc0e.9befbc","type":"mqtt out","z":"98cfac7a.d84cf8","name":"ERROR_REPORT","topic":"","qos":"","retain":"","broker":"af39dd36.0e8058","x":980,"y":920,"wires":[]},{"id":"e8471ea7.f7e1e8","type":"inject","z":"98cfac7a.d84cf8","name":"","topic":"","payload":"Test","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":970,"wires":[["d08624b3.de1ca8"]]},{"id":"9815e08.0b8cf2","type":"debug","z":"98cfac7a.d84cf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1100,"y":970,"wires":[]},{"id":"e85a793d.fd2ee8","type":"simple-queue","z":"98cfac7a.d84cf8","name":"queue1","x":950,"y":970,"wires":[["9815e08.0b8cf2"]]},{"id":"3b7f4d56.4fd6ea","type":"change","z":"98cfac7a.d84cf8","name":"Read","rules":[{"t":"set","p":"trigger","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1010,"wires":[["e85a793d.fd2ee8"]]},{"id":"34b6685a.f54c68","type":"change","z":"98cfac7a.d84cf8","name":"Wipe","rules":[{"t":"set","p":"reset","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1050,"wires":[["e85a793d.fd2ee8"]]},{"id":"c41ab019.3587d","type":"inject","z":"98cfac7a.d84cf8","name":"Wipe","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":1050,"wires":[["34b6685a.f54c68"]]},{"id":"ba2e4c37.49b1a8","type":"inject","z":"98cfac7a.d84cf8","name":"Read","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":1010,"wires":[["3b7f4d56.4fd6ea"]]},{"id":"d08624b3.de1ca8","type":"function","z":"98cfac7a.d84cf8","name":"Name flow","func":"msg.topic = \"Local Readings\";\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":920,"wires":[["ac65f9f0.e3fa9"]]},{"id":"ac65f9f0.e3fa9","type":"change","z":"98cfac7a.d84cf8","name":"","rules":[{"t":"set","p":"error","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":920,"wires":[["cf3a10d9.9043d","26edae58.39e532"]]},{"id":"a11384d1.34a88","type":"function","z":"98cfac7a.d84cf8","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":810,"y":920,"wires":[["19adcc0e.9befbc","e85a793d.fd2ee8"]]},{"id":"4a395e4a.3fd61","type":"link in","z":"98cfac7a.d84cf8","name":"","links":["585d89f4.3fa05"],"x":705,"y":960,"wires":[["a11384d1.34a88"]]},{"id":"17fe672e.a2aed1","type":"inject","z":"98cfac7a.d84cf8","name":"","topic":"","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":478,"y":830,"wires":[["cf3a10d9.9043d"]]},{"id":"8145c990.cacbf8","type":"inject","z":"98cfac7a.d84cf8","name":"","topic":"","payload":"go","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"1","x":478,"y":870,"wires":[["cf3a10d9.9043d"]]},{"id":"cf3a10d9.9043d","type":"traffic","z":"98cfac7a.d84cf8","name":"","property_allow":"payload","filter_allow":"go","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"stop","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":648,"y":920,"wires":[["a11384d1.34a88"]]},{"id":"26edae58.39e532","type":"debug","z":"98cfac7a.d84cf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":630,"y":880,"wires":[]},{"id":"af39dd36.0e8058","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'"}]
Now if I put the first bit of code on THAT flow/tab, and press the inject button, I get:
local Readings : msg : Object
object
_msgid: "e0033ac7.5a9ed8"
topic: "Local Readings"
payload: 1535861136083
error: 1535861136083
_error: object
empty
at the first debug node.
Pressing the READ button (inject node) I get the same at the second debug node.
I was told that MQTT doesn't handle error message when I was sending messages over it, and was shown how to get around that.
Which is what I have done with the CHANGE node.
But that's academic because all this is way before MQTT is used.
So what is happening to the error message?
I'll dig around too, but (as you may have guessed:) I need to ask.
Thanks.