Use same translation string for errors

This commit is contained in:
Mike Jolley 2016-06-20 10:54:23 +01:00
parent 05bf00657d
commit b2ddd379e3
4 changed files with 5 additions and 5 deletions

View File

@ -1798,7 +1798,7 @@ class WC_API_Products extends WC_API_Resource {
) ); ) );
if ( is_wp_error( $response ) ) { if ( is_wp_error( $response ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s: %s', 'woocommerce' ), $image_url, $response->get_error_message() ), 400 ); throw new WC_API_Exception( 'woocommerce_api_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url . ': ' . $response->get_error_message() ), 400 );
} elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) { } elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ), 400 ); throw new WC_API_Exception( 'woocommerce_api_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ), 400 );
} }

View File

@ -2354,7 +2354,7 @@ class WC_API_Products extends WC_API_Resource {
) ); ) );
if ( is_wp_error( $response ) ) { if ( is_wp_error( $response ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_remote_' . $upload_for, sprintf( __( 'Error getting remote image %s: %s', 'woocommerce' ), $image_url, $response->get_error_message() ), 400 ); throw new WC_API_Exception( 'woocommerce_api_invalid_remote_' . $upload_for, sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url . ': ' . $response->get_error_message() ), 400 );
} elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) { } elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_remote_' . $upload_for, sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ), 400 ); throw new WC_API_Exception( 'woocommerce_api_invalid_remote_' . $upload_for, sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ), 400 );
} }

View File

@ -2019,7 +2019,7 @@ class WC_CLI_Product extends WC_CLI_Command {
) ); ) );
if ( is_wp_error( $response ) ) { if ( is_wp_error( $response ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s: %s', 'woocommerce' ), $image_url, $response->get_error_message() ) ); throw new WC_CLI_Exception( 'woocommerce_cli_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url . ': ' . $response->get_error_message() ) );
} elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) { } elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ) ); throw new WC_CLI_Exception( 'woocommerce_cli_invalid_remote_product_image', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ) );
} }

View File

@ -65,9 +65,9 @@ function wc_rest_upload_image_from_url( $image_url ) {
) ); ) );
if ( is_wp_error( $response ) ) { if ( is_wp_error( $response ) ) {
return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s: %s', 'woocommerce' ), $image_url, $response->get_error_message() ), array( 'status' => 400 ) ); return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url . ': ' . $response->get_error_message() ), array( 'status' => 400 ) );
} elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) { } elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s.', 'woocommerce' ), $image_url ), array( 'status' => 400 ) ); return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s', 'woocommerce' ), $image_url ), array( 'status' => 400 ) );
} }
// Ensure we have a file name and type. // Ensure we have a file name and type.