WebDriver/WebDriver/Exception/FailedCommand.php
final public static function factory(
        WebDriver_Command $command,
        array $infoList = [],
        $rawResponse = null,
        $responseJson = null
    ) {

        if (!isset($responseJson['status'])) {
            $errorMessage = "Unknown error";
        } elseif (static::isOk($responseJson['status'])) {
            $errorMessage = "Unexpected Ok status {$responseJson['status']}";
        } elseif (static::isKnownError($responseJson['status'])) {
            $errorMessage = static::getErrorMessage($responseJson['status']);
        } else {
            $errorMessage = "Unknown error status: {$responseJson['status']}";
        }
        $messageList = [$errorMessage];
        if (isset($responseJson['value']['message'])) {
            $messageList[] = $responseJson['value']['message'];
        }
        $messageList[] = static::getCommandDescription($command);
        $messageList[] = "HTTP Status Code: {$infoList['http_code']}";
        switch ($responseJson['status']) {
            case self::STALE_ELEMENT_REFERENCE:
                $e = new WebDriver_Exception_StaleElementReference(
                    implode("\n", $messageList),
                    $responseJson['status']
                );
                $e->responseList = $responseJson;
                return $e;
            default:
                $e = new WebDriver_Exception_FailedCommand(implode("\n", $messageList), $responseJson['status']);
                $e->responseList = $responseJson;
                return $e;
        }
    }
final public static function factory(
        WebDriver_Command $command,
        array $infoList = [],
        $rawResponse = null,
        $responseJson = null
    ) {

        if (!isset($responseJson['status'])) {
            $errorMessage = "Unknown error";
        } elseif (static::isOk($responseJson['status'])) {
            $errorMessage = "Unexpected Ok status {$responseJson['status']}";
        } elseif (static::isKnownError($responseJson['status'])) {
            $errorMessage = static::getErrorMessage($responseJson['status']);
        } else {
            $errorMessage = "Unknown error status: {$responseJson['status']}";
        }
        $messageList = [$errorMessage];
        if (isset($responseJson['value']['message'])) {
            $messageList[] = $responseJson['value']['message'];
        }
        $messageList[] = static::getCommandDescription($command);
        $messageList[] = "HTTP Status Code: {$infoList['http_code']}";
        switch ($responseJson['status']) {
            case self::STALE_ELEMENT_REFERENCE:
                $e = new WebDriver_Exception_StaleElementReference(
                    implode("\n", $messageList),
                    $responseJson['status']
                );
                $e->responseList = $responseJson;
                return $e;
            default:
                $e = new WebDriver_Exception_FailedCommand(implode("\n", $messageList), $responseJson['status']);
                $e->responseList = $responseJson;
                return $e;
        }
    }
final public static function factory ( WebDriver_Command $ command , array $ infoList = [ ] , $ rawResponse = null , $ responseJson = null ) { if ( ! isset ( $ responseJson [ 'status' ] ) ) { $ errorMessage = "Unknown error" ; } elseif ( static :: isOk ( $ responseJson [ 'status' ] ) ) { $ errorMessage = "Unexpected Ok status {$responseJson['status']}" ; } elseif ( static :: isKnownError ( $ responseJson [ 'status' ] ) ) { $ errorMessage = static :: getErrorMessage ( $ responseJson [ 'status' ] ) ; } else { $ errorMessage = "Unknown error status: {$responseJson['status']}" ; } $ messageList = [ $ errorMessage ] ; if ( isset ( $ responseJson [ 'value' ] [ 'message' ] ) ) { $ messageList [ ] = $ responseJson [ 'value' ] [ 'message' ] ; } $ messageList [ ] = static :: getCommandDescription ( $ command ) ; $ messageList [ ] = "HTTP Status Code: {$infoList['http_code']}" ; switch ( $ responseJson [ 'status' ] ) { case self :: STALE_ELEMENT_REFERENCE : $ e = new WebDriver_Exception_StaleElementReference ( implode ( "\n" , $ messageList ) , $ responseJson [ 'status' ] ) ; $ e -> responseList = $ responseJson ; return $ e ; default : $ e = new WebDriver_Exception_FailedCommand ( implode ( "\n" , $ messageList ) , $ responseJson [ 'status' ] ) ; $ e -> responseList = $ responseJson ; return $ e ; } }
Factory for all failed command exceptions.

@param WebDriver_Command $command
@param array $infoList
@param null|string $rawResponse
@param null|array $responseJson
@return WebDriver_Exception_FailedCommand
Factory for all failed command exceptions .