diff options
author | 2017-06-01 18:12:09 -0700 | |
---|---|---|
committer | 2017-06-01 18:12:09 -0700 | |
commit | 439c29108e60da2f8cc70d8aec7b6ba21e51516d (patch) | |
tree | 840822f4248f1c64ce7d1ecfb042638ddf55b7aa /Firebase/Auth/Source/FIRAuthErrorUtils.m | |
parent | 51ed6b0a4fbdea5db5f57dcdd50e13463d652485 (diff) |
Handle missing email error (#54)
Adds appropriate error handling for missing email in the createUserWithEmail:password:completion: flow.
Also fixes a few typos.
Diffstat (limited to 'Firebase/Auth/Source/FIRAuthErrorUtils.m')
-rw-r--r-- | Firebase/Auth/Source/FIRAuthErrorUtils.m | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Firebase/Auth/Source/FIRAuthErrorUtils.m b/Firebase/Auth/Source/FIRAuthErrorUtils.m index 6764c45..92cc78a 100644 --- a/Firebase/Auth/Source/FIRAuthErrorUtils.m +++ b/Firebase/Auth/Source/FIRAuthErrorUtils.m @@ -217,6 +217,11 @@ static NSString *const kFIRAuthErrorMessageInvalidSender = @"The email template static NSString *const kFIRAuthErrorMessageInvalidRecipientEmail = @"The action code is invalid. " "This can happen if the code is malformed, expired, or has already been used."; +/** @var kFIRAuthErrorMessageMissingEmail + @brief Message for @c FIRAuthErrorCodeMissingEmail error code. + */ +static NSString *const kFIRAuthErrorMessageMissingEmail = @"An email address must be provided."; + /** @var kFIRAuthErrorMessageMissingContinueURI @brief Message for @c FIRAuthErrorCodeMissingContinueURI error code. */ @@ -381,6 +386,8 @@ static NSString *FIRAuthErrorDescription(FIRAuthErrorCode code) { return kFIRAuthErrorMessageInvalidMessagePayload; case FIRAuthErrorCodeInvalidRecipientEmail: return kFIRAuthErrorMessageInvalidRecipientEmail; + case FIRAuthErrorCodeMissingEmail: + return kFIRAuthErrorMessageMissingEmail; case FIRAuthErrorCodeMissingPhoneNumber: return kFIRAuthErrorMessageMissingPhoneNumber; case FIRAuthErrorCodeInvalidPhoneNumber: @@ -474,6 +481,8 @@ static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) { return @"ERROR_INVALID_SENDER"; case FIRAuthErrorCodeInvalidRecipientEmail: return @"ERROR_INVALID_RECIPIENT_EMAIL"; + case FIRAuthErrorCodeMissingEmail: + return @"MISSING_EMAIL"; case FIRAuthErrorCodeMissingPhoneNumber: return @"ERROR_MISSING_PHONE_NUMBER"; case FIRAuthErrorCodeInvalidPhoneNumber: @@ -731,6 +740,10 @@ static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) { return [self errorWithCode:FIRAuthInternalErrorCodeInvalidRecipientEmail message:message]; } ++ (NSError *)missingEmail { + return [self errorWithCode:FIRAuthInternalErrorCodeMissingEmail]; +} + + (NSError *)missingPhoneNumberErrorWithMessage:(nullable NSString *)message { return [self errorWithCode:FIRAuthInternalErrorCodeMissingPhoneNumber message:message]; } |