WC_Data_Exception::__construct
Setup exception.
Метод класса: WC_Data_Exception{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WC_Data_Exception = new WC_Data_Exception(); $WC_Data_Exception->__construct( $code, $message, $http_status_code, $data );
- $code(строка) (обязательный)
- Machine-readable error code, e.g
woocommerce_invalid_product_id. - $message(строка) (обязательный)
- User-friendly translated error message, e.g.
'Product ID is invalid'. - $http_status_code(int)
- Proper HTTP status code to respond with, e.g. 400.
По умолчанию:400 - $data(массив)
- Extra error data.
По умолчанию:array()
Код WC_Data_Exception::__construct() WC Data Exception:: construct WC 10.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 );
}