WC_Data_Exception::__construct()publicWC 1.0

Setup exception.

{} It's a method of the class: WC_Data_Exception{}

No Hooks.


null. Nothing.


$WC_Data_Exception = new WC_Data_Exception();
$WC_Data_Exception->__construct( $code, $message, $http_status_code, $data );
$code(string) (required)
Machine-readable error code, e.g woocommerce_invalid_product_id.
$message(string) (required)
User-friendly translated error message, e.g. 'Product ID is invalid'.
Proper HTTP status code to respond with, e.g. 400.
Default: 400
Extra error data.
Default: array()

Code of WC_Data_Exception::__construct() WC 6.7.0

public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
	$this->error_code = $code;
	$this->error_data = array_merge( array( 'status' => $http_status_code ), $data );

	parent::__construct( $message, $http_status_code );