WC_Data::error()
When invalid data is found, throw an exception unless reading from the DB.
Method of the class: WC_Data{}
No Hooks.
Return
null
. Nothing (null).
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. |
WC_Data::error() WC Data::error code WC 9.8.2
protected function error( $code, $message, $http_status_code = 400, $data = array() ) { throw new WC_Data_Exception( $code, $message, $http_status_code, $data ); }