Skip to content

Commit e334e5e

Browse files
committed
tweaking error handling (again)
1 parent 4a0c79a commit e334e5e

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
@@ -157,18 +157,12 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
157157
);
158158
}
159159

160-
$value = $this->offsetGet('value', $result);
161-
$message = $this->offsetGet('message', $result);
162-
$error = $this->offsetGet('error', $result);
160+
$value = $this->offsetGet('value', $result);
163161

164-
if ($message === null) {
162+
if (($message = $this->offsetGet('message', $result)) === null) {
165163
$message = $this->offsetGet('message', $value);
166164
}
167165

168-
if ($error === null) {
169-
$error = $this->offsetGet('error', $value);
170-
}
171-
172166
// if not success, throw exception
173167
if (isset($result['status']) && (int) $result['status'] !== 0) {
174168
throw WebDriverException::factory(
@@ -177,6 +171,10 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
177171
);
178172
}
179173

174+
if (($error = $this->offsetGet('error', $result)) === null) {
175+
$error = $this->offsetGet('error', $value);
176+
}
177+
180178
if (isset($error)) {
181179
throw WebDriverException::factory(
182180
$error,

0 commit comments

Comments
 (0)