Automattic\WooCommerce\StoreApi\Schemas\V1

ErrorSchema::get_item_response()publicWC 1.0

Convert a WP_Error into an object suitable for the response.

Method of the class: ErrorSchema{}

No Hooks.

Return

Array.

Usage

$ErrorSchema = new ErrorSchema();
$ErrorSchema->get_item_response( $error );
$error(\WP_Error) (required)
Error object.

ErrorSchema::get_item_response() code WC 8.7.0

public function get_item_response( $error ) {
	return [
		'code'    => $this->prepare_html_response( $error->get_error_code() ),
		'message' => $this->prepare_html_response( $error->get_error_message() ),
	];
}