WC_API_Exception::__construct()publicWC 2.2

Setup exception, requires 3 params:

error code - machine-readable, e.g. woocommerce_invalid_product_id error message - friendly message, e.g. 'Product ID is invalid' http status code - proper HTTP status code to respond with, e.g. 400

Метод класса: WC_API_Exception{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_API_Exception = new WC_API_Exception();
$WC_API_Exception->__construct( $error_code, $error_message, $http_status_code );
$error_code(строка) (обязательный)
-
$error_message(строка) (обязательный)
user-friendly translated error message
$http_status_code(int) (обязательный)
HTTP status code to respond with

Список изменений

С версии 2.2 Введена.

Код WC_API_Exception::__construct() WC 8.7.0

public function __construct( $error_code, $error_message, $http_status_code ) {
	$this->error_code = $error_code;
	parent::__construct( $error_message, $http_status_code );
}