Automattic\WooCommerce\Blocks\Domain\Services
CreateAccount::map_create_account_error() private WC 1.0
Convert an account creation error to an exception.
{} It's a method of the class: CreateAccount{}
No Hooks.
Return
Exception..
Usage
// private - for code of main (parent) class only $result = $this->map_create_account_error( \WP_Error $error );
- \WP_Error $error (required)
- -
Code of CreateAccount::map_create_account_error() CreateAccount::map create account error WC 5.0.0
private function map_create_account_error( \WP_Error $error ) {
switch ( $error->get_error_code() ) {
// WordPress core error codes.
case 'empty_username':
case 'invalid_username':
case 'empty_email':
case 'invalid_email':
case 'email_exists':
case 'registerfail':
return new \Exception( 'woocommerce_rest_checkout_create_account_failure' );
}
return new \Exception( 'woocommerce_rest_checkout_create_account_failure' );
}