-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[py] Fix error handler check_response #15887
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to bbea0f2
Previous suggestionsSuggestions up to commit ab9591a
✅ Suggestions up to commit a77fa66
|
This is very helpful |
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.
LGTM
User description
🔗 Related Issues
Fixes #15883
💥 What does this PR do?
This PR fixes the
check_response
method of theErrorHandler
class in/py/selenium/webdriver/remote/errorhandler.py
.Previously, if a webdriver returned an error response that didn't contain json, it would raise an unrelated exception.
This PR also adds unit tests for these circumstances.
🔄 Types of changes
PR Type
Bug fix
Description
• Fix error handler for non-JSON responses
• Add unit tests for numeric and non-JSON error cases
• Prevent unrelated exceptions when webdriver returns non-JSON errors
Changes walkthrough 📝
errorhandler.py
Fix JSON parsing in error handler
py/selenium/webdriver/remote/errorhandler.py
• Move json import to top of file
• Add check for numeric strings
before JSON parsing
• Prevent ValueError when response value is not
valid JSON
error_handler_tests.py
Add tests for non-JSON error responses
py/test/unit/selenium/webdriver/remote/error_handler_tests.py
• Move json import to top of file
• Add test for numeric value error
handling
• Add test for non-JSON error response handling
• Remove
inline json imports from existing tests