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

[py] mapped all error codes in errorhandler.py to corresponding exception object. #12190

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

sandeepsuryaprasad
Copy link
Contributor

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Mapped all error codes in ErrorCode object in remote/errorhandler.py to corresponding exception object by creating a new object ExceptionMapping.

Motivation and Context

  • In ErrorHandler object in remote/errorhandler.py, there is a giant conditional statement which actually assigns an exception object to a variable exception_class depending on status.

  • All error codes and its corresponding values are maintained in ErrorCode object. Through multiple conditional statements, an exception object is being assigned to variable exception_class depending on status in response.

  • I have mapped all error codes in ErrorCode object and its corresponding exception object in a separate ExceptionClass object, so that multiple if-elif-else block is avoided in ErrorHandler object.

  • Added a new logic to assign exception_class variable by replacing conditional statements. Now the code in ErrorHandler object is reduced to a great extent.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • [] My change requires a change to the documentation.
  • [] I have updated the documentation accordingly.
  • [] I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 92.50% and project coverage change: +0.32 🎉

Comparison is base (7cfd137) 56.56% compared to head (a9e95b7) 56.89%.

❗ Current head a9e95b7 differs from pull request most recent head bfb6704. Consider uploading reports for the commit bfb6704 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #12190      +/-   ##
==========================================
+ Coverage   56.56%   56.89%   +0.32%     
==========================================
  Files          86       86              
  Lines        5450     5428      -22     
  Branches      223      226       +3     
==========================================
+ Hits         3083     3088       +5     
+ Misses       2144     2114      -30     
- Partials      223      226       +3     
Impacted Files Coverage Δ
py/selenium/webdriver/remote/errorhandler.py 71.67% <92.50%> (+10.65%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

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

Thank you, @sandeepsuryaprasad!

@diemol diemol merged commit 2ebfcd9 into SeleniumHQ:trunk Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants