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

[openuv] Enhance server side error handling #12958

Merged
merged 7 commits into from
Jun 19, 2022
Merged

Conversation

clinique
Copy link
Contributor

@clinique clinique commented Jun 18, 2022

This pull request is aimed to solve issue #12932 .
It helps the binding auto reconnect on two known server issues, when db is not available, and when a good apikey fails due to....wrong behaviour of the server.

If these errors are detected, the bridge goes offline for five minutes, then tries to reconnect.

Signed-off-by: clinique gael@lhopital.org

Signed-off-by: clinique <gael@lhopital.org>
@clinique clinique self-assigned this Jun 18, 2022
@clinique clinique added the enhancement An enhancement or new feature for an existing add-on label Jun 18, 2022
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

Thanks! I have added a few minor comments.

Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
scheduleReconnectJob(RECONNECT_DELAY_MIN);
} else {
statusDetail = ThingStatusDetail.NONE;
statusMessage = String.format("@text/offline.invalid-json [ \"%s\", \"%s\" ]", url, jsonData);
Copy link
Contributor

Choose a reason for hiding this comment

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

A relatively small message is expected (it will be displayed in UI). Is your jsonData small ?
If not, maybe you shoudl add a specific DEBUG log entry to log jsonData

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Size of invalid json is not easy to predict, so I take your proposal.

Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM

@lolodomo
Copy link
Contributor

@jlaur : I let you check your comments and merge if this is ok

Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

LGTM

@jlaur jlaur merged commit 3a632ca into openhab:main Jun 19, 2022
@jlaur jlaur added this to the 3.3 milestone Jun 19, 2022
@clinique clinique deleted the openuv_12932 branch June 19, 2022 12:58
@jlaur jlaur linked an issue Jun 19, 2022 that may be closed by this pull request
leifbladt pushed a commit to leifbladt/openhab-addons that referenced this pull request Oct 15, 2022
* Enhance server side error handling
* Enhancing exception tree
* a small factorization of error status
* Shorten statusMessage
* Correcting log syntax

Signed-off-by: clinique <gael@lhopital.org>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
* Enhance server side error handling
* Enhancing exception tree
* a small factorization of error status
* Shorten statusMessage
* Correcting log syntax

Signed-off-by: clinique <gael@lhopital.org>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
* Enhance server side error handling
* Enhancing exception tree
* a small factorization of error status
* Shorten statusMessage
* Correcting log syntax

Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
* Enhance server side error handling
* Enhancing exception tree
* a small factorization of error status
* Shorten statusMessage
* Correcting log syntax

Signed-off-by: clinique <gael@lhopital.org>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Feb 28, 2023
* Enhance server side error handling
* Enhancing exception tree
* a small factorization of error status
* Shorten statusMessage
* Correcting log syntax

Signed-off-by: clinique <gael@lhopital.org>
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.

[openuv] invalid json received
3 participants