WooCommerce Code Reference

WC_REST_Exception extends WC_Data_Exception
in package

WC_REST_Exception class.

Table of Contents

$error_code  : string
Sanitized error code.
$error_data  : array<string|int, mixed>
Error extra data.
__construct()  : mixed
Setup exception.
getErrorCode()  : string
Returns the error code.
getErrorData()  : array<string|int, mixed>
Returns error data.




Setup exception.

public __construct(string $code, string $message[, int $http_status_code = 400 ][, array<string|int, mixed> $data = array() ]) : mixed
$code : string

Machine-readable error code, e.g woocommerce_invalid_product_id.

$message : string

User-friendly translated error message, e.g. 'Product ID is invalid'.

$http_status_code : int = 400

Proper HTTP status code to respond with, e.g. 400.

$data : array<string|int, mixed> = array()

Extra error data.

Return values