Automattic\WooCommerce\StoreApi\Routes\V1\Ucp
AbstractCatalogRoute::ucp_error
Build a transport-level error response.
Method of the class: AbstractCatalogRoute{}
No Hooks.
Returns
\WP_REST_Response.
Usage
// protected - for code of main (parent) or child class $result = $this->ucp_error( $code, $message, $severity, $status ): \WP_REST_Response;
- $code(string) (required)
- Error code.
- $message(string) (required)
- Error message.
- $severity(string) (required)
- Error severity.
- $status(int) (required)
- HTTP status.
AbstractCatalogRoute::ucp_error() AbstractCatalogRoute::ucp error code WC 11.3.0
protected function ucp_error( string $code, string $message, string $severity, int $status ): \WP_REST_Response {
return new \WP_REST_Response(
array(
'ucp' => $this->ucp_metadata( 'error' ),
'messages' => array(
array(
'type' => 'error',
'code' => $code,
'content' => $message,
'severity' => $severity,
'path' => '$',
'content_type' => 'plain',
),
),
),
$status
);
}