-
-
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
[dotnet] Remove indirection through Response
on HTTP exception
#14892
Open
RenderMichael
wants to merge
3
commits into
SeleniumHQ:trunk
Choose a base branch
from
RenderMichael:http-exception
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't mind.
Do you see potential miss-using? It is new exception type...
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.
Luckily this is the same behavior which already exists. Currently the method
UnpackAndThrowOnError
throws the same exception. The only difference here is the more specific message and inner exception passed instead toe.ToString()
appending to the message.For reasons I expanded in the PR description, this doesn’t change any execution, so there’s no potential issue here.
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.
All right. Let's think how to improve the error. This error will be user faced in any cace of network issue - it is so popular.
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.
Unhandled error while executing <command>.
?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.
This is actually not the exception users will see. If this exception is thrown, it is handled and transformed
HttpRequestException
->WebDriverException
earlier in the code, here:selenium/dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Lines 201 to 205 in 4ea71ca
Reaching this point is not very common. A user would need to provide their own
ICommandExecutor
implementation do see this. It is still reachable, but not like it seems.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.
Looking into it, I see
UnhandledError
maps to the server errors forunknown error
andunsupported operation
.selenium/dotnet/src/webdriver/WebDriverError.cs
Lines 225 to 229 in cc5ca35
What should we do with these?
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.
@YevgeniyShunevych do you have preferences? In case of network issues on client side:
WebDriverException
with message likethe specific command failed to execute
(including original exception as inner)HttpRequestException
as isMy personal preference is to throw as is, don't try to handle everything and re-throw because of we cannot commit to handle everything. One more point against
WebDriverException
: actually it is network issue rather than WebDriver. If it isWebDriverException
, then most likely we should fix it, but we can not. It leads people to blame selenium, not theirs's network.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.
Introduce new exception types, strongly typed. If somebody else in ruby, python, java, js has already at least one of these, then definitely introduce. Otherwise we will be the first.
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.
Opened a PR for removing
UnhandledError
#14936Broken off from this PR because there is still a decision to be made about wrapping in
WebDriverException
or not.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.
Are we the first Cristoforo Colombo, did you check?