WordPress.org

Make WordPress Core

Ticket #16280: 16280.diff

File 16280.diff, 665 bytes (added by solarissmoke, 4 years ago)

Pass on original wp_error when http request fails

  • wp-admin/includes/theme.php

     
    391391        if ( ! $res ) { 
    392392                $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) ); 
    393393                if ( is_wp_error($request) ) { 
    394                         $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); 
     394                        $res = $request; 
    395395                } else { 
    396396                        $res = unserialize($request['body']); 
    397397                        if ( ! $res )