WooCommerce Code Reference

Search results

WC_REST_Exception extends WC_Data_Exception

WC_REST_Exception class.

Table of Contents

$error_code Sanitized error code. string
$error_data Error extra data. array
__construct() Setup exception. mixed
getErrorCode() Returns the error code. string
getErrorData() Returns error data. array




Setup exception.

public __construct( $code : string , $message : string [, $http_status_code : int = 400 ] [, $data : array = 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 = array()

Extra error data.

Return values
Back to the top