Skip to content

Commit

Permalink
[dotnet] ignore exceptions from Quit when new session fails
Browse files Browse the repository at this point in the history
In order to propagate the original error when session fails, surround the Quit call in try/catch in case it also throws an exception.
  • Loading branch information
Indomitable committed Jul 10, 2024
1 parent 3d4c86f commit ab86f81
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dotnet/src/webdriver/WebDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ protected WebDriver(ICommandExecutor executor, ICapabilities capabilities)
}
catch (Exception)
{
// Failed to start driver session, disposing of driver
this.Quit();
try
{
// Failed to start driver session, disposing of driver
this.Quit();
}
catch
{
// Ignore the clean-up exception. We'll propagate the original failure.
}
throw;
}

Expand Down

0 comments on commit ab86f81

Please sign in to comment.