Skip to content

Commit fd8580d

Browse files
committed
tweaking error handling (again)
1 parent 6fc747a commit fd8580d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/WebDriver/AbstractWebDriver.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,12 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
205205
);
206206
}
207207

208-
$value = $this->offsetGet('value', $result);
209-
$message = $this->offsetGet('message', $result);
210-
$error = $this->offsetGet('error', $result);
208+
$value = $this->offsetGet('value', $result);
211209

212-
if ($message === null) {
210+
if (($message = $this->offsetGet('message', $result)) === null) {
213211
$message = $this->offsetGet('message', $value);
214212
}
215213

216-
if ($error === null) {
217-
$error = $this->offsetGet('error', $value);
218-
}
219-
220214
// if not success, throw exception
221215
if (isset($result['status']) && (int) $result['status'] !== 0) {
222216
throw WebDriverException::factory(
@@ -225,6 +219,10 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
225219
);
226220
}
227221

222+
if (($error = $this->offsetGet('error', $result)) === null) {
223+
$error = $this->offsetGet('error', $value);
224+
}
225+
228226
if (isset($error)) {
229227
throw WebDriverException::factory(
230228
$error,

0 commit comments

Comments
 (0)