Skip to content

Commit

Permalink
Closes #6289: Error Code when RUCSS can't be reached (#6347)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeawhanlee authored and wordpressfan committed Mar 15, 2024
1 parent cfcf225 commit eb98fec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inc/Engine/Common/JobManager/APIHandler/AbstractAPIClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ private function check_response( $response ): bool {
if ( 200 !== $this->response_code ) {
$previous_errors = (int) get_transient( 'wp_rocket_rucss_errors_count' );
set_transient( 'wp_rocket_rucss_errors_count', $previous_errors + 1, 5 * MINUTE_IN_SECONDS );

if ( empty( $response ) ) {
$this->error_message = 'API Client Error';
return false;
}

$this->error_message = is_array( $response )
? wp_remote_retrieve_response_message( $response )
: $response->get_error_message();
Expand Down

0 comments on commit eb98fec

Please sign in to comment.