Use same translation string for errors
This commit is contained in:
parent
05bf00657d
commit
b2ddd379e3
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue