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