fix(ofrep): handle 401, 403, 404 and 5xx errors explicitly and add tests#346
fix(ofrep): handle 401, 403, 404 and 5xx errors explicitly and add tests#346thomaspoignant wants to merge 5 commits intomainfrom
Conversation
Summary of ChangesHello @thomaspoignant, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness of the OFREP provider by introducing specific error handling for common HTTP error codes. The changes ensure that the provider can correctly interpret and propagate errors like unauthorized access, forbidden requests, flag not found scenarios, and server-side issues, even when the server's error responses are not in JSON format. This improves the reliability and user experience by providing more accurate and actionable error messages. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #346 +/- ##
===========================================
- Coverage 96.55% 86.44% -10.12%
===========================================
Files 5 1 -4
Lines 174 118 -56
===========================================
- Hits 168 102 -66
- Misses 6 16 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses an issue where non-JSON error responses from the OFREP provider could cause parsing errors. By explicitly handling 401, 403, 404, and 5xx status codes, the provider is now more robust. The added tests are thorough and cover the new error handling paths well. I have one suggestion to improve the structure and consistency of the error handling logic.
providers/openfeature-provider-ofrep/src/openfeature/contrib/provider/ofrep/__init__.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
…code to satisfy ruff complexity Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
5fc4880 to
984b5f5
Compare
…for_http_status Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
984b5f5 to
35fb9bd
Compare
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
…ERAL Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
Description
What was the problem?
How is it resolved?
How can we test?
pytest tests/test_provider.py -vinproviders/openfeature-provider-ofrep/.Checklist