WC_Data_Exception::__construct( string $code, string $message, int $http_status_code = 400, array $data = array() )
Setup exception.
Description Description
Parameters Parameters
- $code
-
(Required) Machine-readable error code, e.g
woocommerce_invalid_product_id
. - $message
-
(Required) User-friendly translated error message, e.g. 'Product ID is invalid'.
- $http_status_code
-
(Optional) Proper HTTP status code to respond with, e.g. 400.
Default value: 400
- $data
-
(Optional) Extra error data.
Default value: array()
Source Source
File: includes/class-wc-data-exception.php
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 ); }