-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Allow EventFiringDecorator to throw exceptions #16470 #16471
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
base: trunk
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
Thank you, @giulong for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
6052f1e
to
b189814
Compare
WebDriverListener has now the throwsExceptions method to configure its behavior with regard to exception management. By default, it returns false, meaning exceptions are suppressed. If overridden to return true, exceptions occurred in the listener execution will be rethrown, so to allow users to manage them on their side. Fixes SeleniumHQ#16470
b189814
to
73b6263
Compare
User description
WebDriverListener has now the throwsExceptions method to configure its behavior with regard to exception management. By default, it returns false, meaning exceptions are suppressed. If overridden to return true, exceptions occurred in the listener execution will be rethrown, so to allow users to manage them on their side.
Fixes #16470
🔄 Types of changes
PR Type
Enhancement
Description
Add
throwsExceptions()
method toWebDriverListener
interfaceAllow listeners to rethrow exceptions instead of suppressing them
Create new
WebDriverListenerException
for wrapped listener exceptionsAdd comprehensive test coverage for exception handling behavior
Diagram Walkthrough
File Walkthrough
WebDriverListener.java
Add throwsExceptions configuration method
java/src/org/openqa/selenium/support/events/WebDriverListener.java
throwsExceptions()
default method returning falseEventFiringDecorator.java
Implement conditional exception rethrow in decorator
java/src/org/openqa/selenium/support/events/EventFiringDecorator.java
fireBeforeEvents()
methodfireAfterEvents()
methodcallListenerMethod()
methodWebDriverListenerException
whereapplicable
WebDriverListenerException.java
Create WebDriverListenerException wrapper class
java/src/org/openqa/selenium/support/events/WebDriverListenerException.java
RuntimeException
EventFiringDecoratorTest.java
Add comprehensive exception rethrow test coverage
java/test/org/openqa/selenium/support/events/EventFiringDecoratorTest.java
beforeAnyCall()
withthrowsExceptions=true
beforeAnyWebDriverCall()
withthrowsExceptions=true
beforeGetWindowHandle()
withthrowsExceptions=true
afterAnyCall()
withthrowsExceptions=true
afterAnyWebDriverCall()
withthrowsExceptions=true
afterGetWindowHandle()
withthrowsExceptions=true