Error method

This commit is contained in:
Mike Jolley 2016-08-23 13:43:26 +01:00
parent 42ce6443e8
commit 74c96e305b
1 changed files with 6 additions and 3 deletions

View File

@ -359,9 +359,12 @@ abstract class WC_Data {
}
/**
* Throw an exception due to invalid data.
* Returns an invalid data WP_Error object.
* @param string $message Error Message.
* @param mixed $data Data the user tried to set.
* @return WP_Error
*/
protected function throw_exception( $id, $message = '', $code = 400 ) {
throw new WC_Data_Exception( $id, $message, $code );
protected function error( $message = '', $data = '' ) {
return new WP_Error( 'invalid-data', $message, $data );
}
}