WordPress at a glance
function is not described

WC_API_Exception::__construct() public WC 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

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

No Hooks.

Return

Null. Nothing.

Usage

$WC_API_Exception = new WC_API_Exception();
$WC_API_Exception->__construct( $error_code, $error_message, $http_status_code );
$error_code(string) (required)
-
$error_message(string) (required)
user-friendly translated error message
$http_status_code(int) (required)
HTTP status code to respond with

Changelog

Since 2.2 Introduced.

Code of WC_API_Exception::__construct() WC 5.0.0

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