Automattic\WooCommerce\Internal\Fulfillments
OrderFulfillmentsRestController::prepare_error_response
Prepare an error response.
Method of the class: OrderFulfillmentsRestController{}
No Hooks.
Returns
WP_REST_Response. The error response.
Usage
// private - for code of main (parent) class only $result = $this->prepare_error_response( $code, $message, $status ): WP_REST_Response;
- $code(string) (required)
- The error code.
- $message(string) (required)
- The error message.
- $status(int) (required)
- The HTTP status code.
OrderFulfillmentsRestController::prepare_error_response() OrderFulfillmentsRestController::prepare error response code WC 10.3.3
private function prepare_error_response( $code, $message, $status ): WP_REST_Response {
return new WP_REST_Response(
array(
'code' => $code,
'message' => $message,
'data' => array( 'status' => $status ),
),
$status
);
}