| @@ 233-237 (lines=5) @@ | ||
| 230 | Jetpack_Client::WPCOM_JSON_API_VERSION |
|
| 231 | ); |
|
| 232 | ||
| 233 | if ( is_wp_error( $response ) ) { |
|
| 234 | /* translators: %1$s is the error code, %2$s is the error message */ |
|
| 235 | $message = sprintf( __( 'Connection test failed (#%1$s: %2$s)', 'jetpack' ), $response->get_error_code(), $response->get_error_message() ); |
|
| 236 | return self::failing_test( $name, $message ); |
|
| 237 | } |
|
| 238 | ||
| 239 | $body = wp_remote_retrieve_body( $response ); |
|
| 240 | if ( ! $body ) { |
|
| @@ 143-146 (lines=4) @@ | ||
| 140 | Jetpack_Client::WPCOM_JSON_API_VERSION |
|
| 141 | ); |
|
| 142 | ||
| 143 | if ( is_wp_error( $response ) ) { |
|
| 144 | /* translators: %1$s is the error code, %2$s is the error message */ |
|
| 145 | WP_CLI::error( sprintf( __( 'Failed to test connection (#%1$s: %2$s)', 'jetpack' ), $response->get_error_code(), $response->get_error_message() ) ); |
|
| 146 | } |
|
| 147 | ||
| 148 | $body = wp_remote_retrieve_body( $response ); |
|
| 149 | if ( ! $body ) { |
|
| @@ 1352-1360 (lines=9) @@ | ||
| 1349 | empty( $named_args['base_api_path'] ) ? 'rest' : $named_args['base_api_path'] |
|
| 1350 | ); |
|
| 1351 | ||
| 1352 | if ( is_wp_error( $response ) ) { |
|
| 1353 | WP_CLI::error( sprintf( |
|
| 1354 | /* translators: %1$s is an endpoint route (ex. /sites/123456), %2$d is an error code, %3$s is an error message. */ |
|
| 1355 | __( 'Request to %1$s returned an error: (%2$d) %3$s.', 'jetpack' ), |
|
| 1356 | $resource_url, |
|
| 1357 | $response->get_error_code(), |
|
| 1358 | $response->get_error_message() |
|
| 1359 | ) ); |
|
| 1360 | } |
|
| 1361 | ||
| 1362 | if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { |
|
| 1363 | WP_CLI::error( sprintf( |
|