-
-
Notifications
You must be signed in to change notification settings - Fork 162
feat: handle 400 error with response message #3147
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
feat: handle 400 error with response message #3147
Conversation
✅ Deploy Preview for go-feature-flag-doc-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3147 +/- ##
=======================================
Coverage 84.95% 84.95%
=======================================
Files 113 113
Lines 5276 5276
=======================================
Hits 4482 4482
Misses 630 630
Partials 164 164 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gogbog Thanks for this pull request, this is really great.
💭 thought: I think we should add a unit test to validate that it works as expected.
If you don't have time to work on it, let me know and I will do it.
# Handle 400 error code | ||
if int(response.status) == HTTPStatus.BAD_REQUEST.value: | ||
response_dict = json.loads(response_body) | ||
errorMessage = response_dict.get("message") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤓 nitpick: to follow the rest of the naming convention it will be better to name the variable error_message
.
Thank you for your quick response. I considered writing tests, but I'm not sure at the moment how to trigger a 400 error from the GOFF side. The The main purpose of this PR is to make the provider more future-proof (e.g., for a potential migration to Let me know if you have any ideas on how we can test this, as I'm not completely sure at the moment. |
Ok got it, that's true that this is not easy to handle this. |
|
Description
The pull request improves error handling for the Python provider.
Currently, the error message is hardcoded. With this update, if a message parameter is sent in the response, it will be displayed."
Let me know if you'd like further refinements!