Skip to content

Commit f202055

Browse files
committed
The crowd has spoken and wants the original exception, not nested.
1 parent 11eecce commit f202055

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,26 @@ public RemoteWebDriver(CommandExecutor executor, Capabilities desiredCapabilitie
112112

113113
try {
114114
startClient();
115-
} catch (Exception e) {
115+
} catch (RuntimeException e) {
116116
try {
117117
stopClient();
118118
} catch (Exception ignored) {
119119
// Ignore the clean-up exception. We'll propagate the original failure.
120120
}
121121

122-
throw new WebDriverException("Failed to start client.", e);
122+
throw e;
123123
}
124124

125125
try {
126126
startSession(desiredCapabilities, requiredCapabilities);
127-
} catch (Exception e) {
127+
} catch (RuntimeException e) {
128128
try {
129129
quit();
130130
} catch (Exception ignored) {
131131
// Ignore the clean-up exception. We'll propagate the original failure.
132132
}
133133

134-
throw new WebDriverException("Failed to start session.", e);
134+
throw e;
135135
}
136136
}
137137

java/server/test/org/openqa/selenium/remote/server/RemoteWebDriverTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public void testStopsClientIfStartClientFails() {
9999
remote.getCapabilities(),
100100
remote.getCapabilities(),
101101
stopCalled);
102-
} catch (WebDriverException e) {
103-
assertTrue(e.getMessage().contains("Failed to start client."));
102+
} catch (RuntimeException e) {
103+
assertTrue(e.getMessage().contains("Stub client that should fail"));
104104

105105
exceptionThrown = true;
106106
}
@@ -123,8 +123,8 @@ public void testQuitsIfStartSessionFails() {
123123
new BadStartSessionRemoteWebDriver(remote.getCommandExecutor(),
124124
remote.getCapabilities(),
125125
remote.getCapabilities());
126-
} catch (WebDriverException e) {
127-
assertTrue(e.getMessage().contains("Failed to start session."));
126+
} catch (RuntimeException e) {
127+
assertTrue(e.getMessage().contains("Stub session that should fail"));
128128

129129
exceptionThrown = true;
130130
}

0 commit comments

Comments
 (0)