Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
One more PR fix: even more detailed error message for bad responses f…
…rom Selenium
  • Loading branch information
gggeek committed Jun 17, 2015
1 parent fcc8314 commit bcd8fa4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/WebDriver/AbstractWebDriver.php
Expand Up @@ -132,10 +132,14 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti

$result = json_decode($rawResult, true);

if (!is_array($result) || !array_key_exists('status', $result)) {
if ($result === null && json_last_error() != JSON_ERROR_NONE) {
throw WebDriverException::factory(Exception::CURL_EXEC, 'Payload received from webdriver is not valid json: ' . substr($rawResult, 0, 1000));
}

if (!is_array($result) || !array_key_exists('status', $result)) {
throw WebDriverException::factory(Exception::CURL_EXEC, 'Payload received from webdriver is valid but unexpected json: ' . substr($rawResult, 0, 1000));
}

$value = null;
if (array_key_exists('value', $result)) {
$value = $result['value'];
Expand Down

0 comments on commit bcd8fa4

Please sign in to comment.