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

[entsoe] Refactor HTTP error handling #17616

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented Oct 22, 2024

The primary objective of this pull request is to improve handling of HTTP error code 401 ("Unauthorized") by eliminating exception message string comparison - see #17416 (comment).

Additionally, we will now provide "openHAB" with version number in the User-Agent header. This will make it possible to reach out to us in case of any issues.

And last, but not least, InterruptedException will no longer be swallowed by HttpUtil and rethrown as IOException. This allows us rethrow InterruptedException all the way up the call chain. This will ensure that the thread interruption request is respected immediately, rather than masking the exception by catching it prematurely.

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur
Copy link
Contributor Author

jlaur commented Oct 22, 2024

@kaikreuzer - can you add @jmelhus to the contributor team, so he will be added as reviewer for ENTSO-E pull requests? He is our new binding maintainer. 🙂

@kaikreuzer
Copy link
Member

Sure thing - done! Welcome @jmelhus 😄

@jlaur
Copy link
Contributor Author

jlaur commented Oct 23, 2024

Sure thing - done! Welcome @jmelhus 😄

Hmm, does it usually take time to come into effect, because I still don't see him here and still can't request review?

@kaikreuzer
Copy link
Member

He is invited and needs to accept the invitation before you can see him there.

@jlaur
Copy link
Contributor Author

jlaur commented Oct 23, 2024

He is invited and needs to accept the invitation before you can see him there.

Ah, thanks!

@jlaur jlaur requested a review from jmelhus October 23, 2024 12:16
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.

Will wait to give @jmelhus some time to confirm.

@jlaur jlaur marked this pull request as draft October 29, 2024 21:42
Copy link
Contributor

@jmelhus jmelhus left a comment

Choose a reason for hiding this comment

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

Thanks, nice additions, looks good to me.

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur marked this pull request as ready for review October 29, 2024 21:59
@jlaur
Copy link
Contributor Author

jlaur commented Oct 29, 2024

Thanks, nice additions, looks good to me.

Thanks for reviewing. What a coincidence: I marked the PR as draft one minute before your approval. The reason was that I was looking into #17668 and started doing a fix when realizing that the Request and Client classes in entsoe was taken from fmiweather. 😄 So I was doing the same refactoring there and noticed that I had missed the HTTP error code in the exception message. This is fixed now.

@jlaur jlaur added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Oct 29, 2024
@lsiepel lsiepel merged commit 488832d into openhab:main Oct 29, 2024
4 of 5 checks passed
@lsiepel lsiepel added this to the 4.3 milestone Oct 29, 2024
@jlaur jlaur deleted the entsoe-http-refactoring branch October 29, 2024 22:18
KaaNee pushed a commit to KaaNee/openhab-addons that referenced this pull request Nov 8, 2024
* Refactor HTTP error handling

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Dec 16, 2024
* Refactor HTTP error handling

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants