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

[dotnet] Remove indirection through Response on HTTP exception #14892

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions dotnet/src/webdriver/WebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,7 @@ protected virtual async Task<Response> ExecuteAsync(string driverCommandToExecut
}
catch (System.Net.Http.HttpRequestException e)
{
commandResponse = new Response
{
Status = WebDriverResult.UnhandledError,
Value = e
};
throw new WebDriverException("The " + driverCommandToExecute + " command failed to send.", e);
Copy link
Member

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...

Copy link
Contributor Author

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 to e.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.

Copy link
Member

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.

Copy link
Member

@nvborisenko nvborisenko Dec 19, 2024

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>. ?

}

if (commandResponse.Status != WebDriverResult.Success)
Expand Down