Skip to content

Commit f7d782c

Browse files
committed
ref #107 - redo error handling from 31da8b2
1 parent 8ecaf2b commit f7d782c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/WebDriver/AbstractWebDriver.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,12 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
236236
}
237237

238238
$value = (is_array($result) && array_key_exists('value', $result)) ? $result['value'] : null;
239-
$message = (is_array($value) && array_key_exists('message', $value)) ? $value['message'] : null;
239+
$message = (is_array($result) && array_key_exists('message', $result))
240+
? $result['message']
241+
: ((is_array($value) && array_key_exists('message', $value)) ? $value['message'] : null);
242+
$error = (is_array($result) && array_key_exists('error', $result))
243+
? $result['error']
244+
: ((is_array($value) && array_key_exists('error', $value)) ? $value['error'] : null);
240245

241246
// if not success, throw exception
242247
if (isset($result['status']) && (int) $result['status'] !== 0) {
@@ -246,9 +251,9 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
246251
);
247252
}
248253

249-
if (isset($value['error'])) {
254+
if (isset($error)) {
250255
throw WebDriverException::factory(
251-
$value['error'],
256+
$error,
252257
$message
253258
);
254259
}

0 commit comments

Comments
 (0)