-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[cdp][java] Allow filters to recover from failed requests in NetworkInterceptor #13847
[cdp][java] Allow filters to recover from failed requests in NetworkInterceptor #13847
Conversation
The changes LGTM. Can you help open it up for review? Please also sign the CLA @joebandenburg. Thank you for your contribution. |
2a37565
to
12eba88
Compare
…nterceptor This change introduces a new exception, which is thrown through the user's filter chain when the browser fails to get a response for a request and a NetworkInterceptor is in use. This gives the filter an opportunity to catch the exception and return a custom HTTP response. Related to SeleniumHQ#13774
12eba88
to
1a6c55c
Compare
PR Description updated to latest commit (1a6c55c)
|
PR Review
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
I'm not sure whether this constitutes a breaking API change. Existing filters may already catch |
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.
Thank you @joebandenburg!
…nterceptor (SeleniumHQ#13847) Co-authored-by: Puja Jagani <[email protected]>
User description
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
This change introduces a new exception, which is thrown through the user's filter chain when the browser fails to get a response for a request and a NetworkInterceptor is in use.
This gives the filter an opportunity to catch the exception and return a custom HTTP response.
Motivation and Context
Allow the user to intercept failed requests. See #13774 for more details.
Types of changes
Checklist
I'm not sure if this requires a documentation change but I think it would probably help and I'm happy to do that, if others agree.
Type
Enhancement, Tests
Description
RequestFailedException
to manage scenarios where the browser fails to send a HTTP request, allowing for custom error handling.Network.java
to throw and handleRequestFailedException
appropriately, giving users the ability to respond with custom HTTP responses or to let the browser handle the error.Changes walkthrough
RequestFailedException.java
Add new RequestFailedException for handling failed HTTP requests
java/src/org/openqa/selenium/devtools/RequestFailedException.java
RequestFailedException
to handle failedHTTP requests in a filter chain.
Network.java
Enhance Network error handling with RequestFailedException
java/src/org/openqa/selenium/devtools/idealized/Network.java
RequestFailedException
when a networkrequest fails.
RequestFailedException
to allow custom userresponses or continue normal processing.
NetworkInterceptorTest.java
Add tests for RequestFailedException handling in NetworkInterceptor
java/test/org/openqa/selenium/devtools/NetworkInterceptorTest.java
RequestFailedException
is caughtor not caught by a filter.