Open Frostlock opened 4 years ago
Check format of JSON output - it is incorrect. You copy payload json string from logs and insert it in above site to check.
Thanks for the feedback :) I see my question might have been confusing. The key point is not the JSON formatting. The key point is how to catch errors that the IOT central platform sends back.
So to be specific: How can I access the
"message":"Error occured while parsing message payload as UTF-8 JSON object."
part of the log above programmatically? If the IOT central sends an error message back I want to be able to know this in my program. I hope that helps to clarify my question :)
I'm using the example code from pypi When sending properties I sometimes mess up and the JSON is not accepted by the IOT hub. With full logging enabled this shows up in the console output but I would like to catch this in a cleaner way. It would be nice to have a "MessageReceived" to subscribe to. Or is there a proper way of doing this which I currently don't see :)
To reproduce add the following to the python example:
iotc.sendProperty('{"broken": json}')
With full logging enabled this shows the following error message in the console: