Automattic\WooCommerce\StoreApi\Schemas\V1
ErrorSchema::get_item_response
Convert a WP_Error into an object suitable for the response.
Method of the class: ErrorSchema{}
No Hooks.
Returns
Array.
Usage
$ErrorSchema = new ErrorSchema(); $ErrorSchema->get_item_response( $error );
- $error(WP_Error) (required)
- Error object.
ErrorSchema::get_item_response() ErrorSchema::get item response code WC 10.8.1
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() ),
];
}