I got into subflows a fair while ago. They are good.
But now and then I get an error from one, and it is confusing me.
I put in a bit of code to create an error if conditions weren't met. I'm not sure that is helping or not, but it has lead me to this question:
If an error is detected, I want to send as much information as possible to help me.
This is the relevant parts of the code which I think - for now - are important.
var device = context.get('device')||0;
and further down in the code I have:
if (ICDID != device)
{
node.warn("Node Configuration not set");
node.error("Node Configuration not set", msg)
// fa-eye-slash
return;
}
This is the message that I receive:
{"_msgid":"935f647e.2f7718","_event":"node:4d0c9a1.2f50be4","error":{"message":"Node Configuration not set","source":{"id":"6c419eb5.eab59","type":"function","name":"Button Colour","count":1}},"time":"2020-08-13 07:40:14","topic":"ERROR_REPORT/TimePi/M C/undefined"}
Now, you can see the Node Configuration not set
part. But it ends there.
(I'm suspicious I just saw the problem. But I'll continue and ask just to be sure.)
The line sends the Node configuration not set which tells me it is actually invoked for that reason. So I want to add the msg
that was received to make this error.
But I'm guessing it needs to be:
node.error("Node Configuration not set" + msg)
Sure it won't actually give me much as it is forgone that ICDID != device
but by this stage in the code it should be.
So I am curious what is happening to cause the error.
Maybe it is an rogue message that somehow gets into the node.
All the other needed values are protected with the || 0
at their ends.
So there is something happening but I am not getting what I expect to see.
And I right abut the +
as opposed to the ,
for message concatenation?