This is the error message I get:
{"_msgid":"95a5f34b.89b7f","topic":"ERROR_REPORT/BedPi/Logging/","error":{"message":"ReferenceError: a is not defined (line 1, col 19)","source":{"id":"f15d59f6.b745","type":"function","name":"This will throw an error","count":1}},"_error":{},"time":"2020-05-20 19:41:31","payload":"Cause an error"}
I am wanting to create a message showing the error which can be written to a text file - human readable.
This is the code I have so far:
let when = msg.time;
let who = msg.topic;
let what = msg.error;
let where = msg.error.source;
node.warn("What " + what);
node.warn("Where " + where);
msg.payload = "When " + when + "\nWho " + who + "\nWhat " + what + "\nWhere " + where;
return msg;
But I get this as the output:
When 2020-05-20 19:41:31Who ERROR_REPORT/BedPi/ERROR_REPORT/BedPi/Logging/What [object Object]Where [object Object]
I'm messing up with the objects. I know.
This is a big (huge) re-write of a lot of code as I finally discovered that what I had doesn't work.