Skip to content

Commit ab86f81

Browse files
committed
[dotnet] ignore exceptions from Quit when new session fails
In order to propagate the original error when session fails, surround the Quit call in try/catch in case it also throws an exception.
1 parent 3d4c86f commit ab86f81

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dotnet/src/webdriver/WebDriver.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,15 @@ protected WebDriver(ICommandExecutor executor, ICapabilities capabilities)
6262
}
6363
catch (Exception)
6464
{
65-
// Failed to start driver session, disposing of driver
66-
this.Quit();
65+
try
66+
{
67+
// Failed to start driver session, disposing of driver
68+
this.Quit();
69+
}
70+
catch
71+
{
72+
// Ignore the clean-up exception. We'll propagate the original failure.
73+
}
6774
throw;
6875
}
6976

0 commit comments

Comments
 (0)