Skip to content

Commit 11eecce

Browse files
committed
Ignore exceptions during the clean-up process if failing to start a RemoteWebDriver instance.
1 parent aaaed83 commit 11eecce

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,23 @@ public RemoteWebDriver(CommandExecutor executor, Capabilities desiredCapabilitie
113113
try {
114114
startClient();
115115
} catch (Exception e) {
116-
stopClient();
116+
try {
117+
stopClient();
118+
} catch (Exception ignored) {
119+
// Ignore the clean-up exception. We'll propagate the original failure.
120+
}
117121

118122
throw new WebDriverException("Failed to start client.", e);
119123
}
120124

121125
try {
122126
startSession(desiredCapabilities, requiredCapabilities);
123127
} catch (Exception e) {
124-
quit();
128+
try {
129+
quit();
130+
} catch (Exception ignored) {
131+
// Ignore the clean-up exception. We'll propagate the original failure.
132+
}
125133

126134
throw new WebDriverException("Failed to start session.", e);
127135
}

0 commit comments

Comments
 (0)