Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mqtt.homeassistant] Include details of JSON parse errors #17452

Merged

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Sep 20, 2024

While it's useful in general to not have to copy/paste a MQTT message into a JSON parser to verify syntax, it also includes details about fields that are the wrong data type that a generic JSON parser won't catch. A la #17375.

Example log line:

2024-09-20 11:06:17.539 [WARN ] [nal.discovery.HomeAssistantDiscovery] - HomeAssistant discover error: invalid configuration of thing smartlock component lock: Cannot parse channel configuration JSON: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 213 path $.avty

…arsing fails

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la openhab#17375.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
@ccutrer ccutrer force-pushed the mqtt-homeassistant-json-parse-error-details branch from 862b118 to 021a75f Compare September 20, 2024 17:21
@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label Sep 20, 2024
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM

@lsiepel lsiepel merged commit ab2dade into openhab:main Sep 20, 2024
4 of 5 checks passed
@lsiepel lsiepel added this to the 4.3 milestone Sep 20, 2024
@lsiepel lsiepel changed the title [mqtt.homeassistant] Include the details of JSON syntax errors when parsing fails [mqtt.homeassistant] Include details of JSON parse errors Sep 20, 2024
@ccutrer ccutrer deleted the mqtt-homeassistant-json-parse-error-details branch September 20, 2024 19:03
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
…arsing fails (openhab#17452)

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la openhab#17375.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Oct 18, 2024
…arsing fails (openhab#17452)

While it's useful in general to not have to copy/paste a MQTT message into a JSON
parser to verify syntax, it also includes details about fields that are the wrong
data type that a generic JSON parser won't catch. A la openhab#17375.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants