WC_API_Exception::__construct()
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
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. |
WC_API_Exception::__construct() WC API Exception:: construct code WC 7.7.0
public function __construct( $error_code, $error_message, $http_status_code ) { $this->error_code = $error_code; parent::__construct( $error_message, $http_status_code ); }