WC_Data::error()protectedWC 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.


null. Nothing.


// 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.
Default: 400
Extra error data.
Default: array()


Since 3.0.0 Introduced.

Code of WC_Data::error() WC 6.9.4

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