WordPress at Your Fingertips
function is not described

WC_Data::error() protected WC 3.0.0

When invalid data is found, throw an exception unless reading from the DB.

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

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->error( $code, $message, $http_status_code, $data );
$code(string) (required)
Error code.
$message(string) (required)
Error message.
$http_status_code(int)
HTTP status code.
Default: 400
$data(array)
Extra error data.
Default: array()

Changelog

Since 3.0.0 Introduced.

Code of WC_Data::error() WC 5.8.0

protected function error( $code, $message, $http_status_code = 400, $data = array() ) {
	throw new WC_Data_Exception( $code, $message, $http_status_code, $data );
}