WC_API_Exception::__construct( string $error_code, string $error_message, int $http_status_code )

Setup exception, requires 3 params:


Description Description

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


Parameters Parameters

$error_code

(Required)

$error_message

(Required) user-friendly translated error message

$http_status_code

(Required) HTTP status code to respond with


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-exception.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.2 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.