WooCommerce Code Reference

WC_Data_Exception extends Exception
in package

Data exception class.

Table of Contents

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

Properties

Methods

__construct()

Setup exception.

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