diff options
author | Zsika Phillip <protocol86@users.noreply.github.com> | 2017-10-02 11:21:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-02 11:21:55 -0700 |
commit | 7fa0b0de42141d90b8ba3da67cad037becf6f065 (patch) | |
tree | ef7599978e5b7aee0731cd70f8f67edeae5c876f /Firebase/Auth | |
parent | aebb293f3dcfaef012e847689d8b814477c0c301 (diff) |
Disambiguates known errors from web context (#322)
* Disambiguates known errors from web context
- Disambiguates known errors possibly returned by verifyPhoneNumber:UIDelegate:completion:
Diffstat (limited to 'Firebase/Auth')
-rw-r--r-- | Firebase/Auth/Source/FIRAuthErrorUtils.m | 38 | ||||
-rw-r--r-- | Firebase/Auth/Source/FIRAuthInternalErrors.h | 10 | ||||
-rw-r--r-- | Firebase/Auth/Source/Public/FIRAuthErrors.h | 8 |
3 files changed, 56 insertions, 0 deletions
diff --git a/Firebase/Auth/Source/FIRAuthErrorUtils.m b/Firebase/Auth/Source/FIRAuthErrorUtils.m index bfa0c41..37f3a22 100644 --- a/Firebase/Auth/Source/FIRAuthErrorUtils.m +++ b/Firebase/Auth/Source/FIRAuthErrorUtils.m @@ -49,6 +49,18 @@ static NSString *const kServerErrorDetailMarker = @" : "; */ static NSString *const kURLResponseErrorCodeInvalidClientID = @"auth/invalid-oauth-client-id"; +/** @var kURLResponseErrorCodeNetworkRequestFailed + @brief Error code that indicates that a network request within the SFSafariViewController or + UIWebView failed. + */ +static NSString *const kURLResponseErrorCodeNetworkRequestFailed = @"auth/network-request-failed"; + +/** @var kURLResponseErrorCodeInternalError + @brief Error code that indicates that an internal error occured within the + SFSafariViewController or UIWebView failed. + */ +static NSString *const kURLResponseErrorCodeInternalError = @"auth/internal-error"; + #pragma mark - Standard Error Messages /** @var kFIRAuthErrorMessageInvalidCustomToken @@ -370,6 +382,18 @@ static NSString *const kFIRAuthErrorMessageWebContextCancelled = @"The interacti static NSString *const kFIRAuthErrorMessageInvalidClientID = @"The OAuth client ID provided is " "either invalid or does not match the specified API key."; +/** @var kFIRAuthErrorMessageWebRequestFailed + @brief Message for @c FIRAuthErrorCodeWebRequestFailed error code. + */ +static NSString *const kFIRAuthErrorMessageWebRequestFailed = @"A network error (such as timeout, " + "interrupted connection, or unreachable host) has occurred within the web context."; + +/** @var kFIRAuthErrorMessageWebInternalError + @brief Message for @c FIRAuthErrorCodeWebInternalError error code. + */ +static NSString *const kFIRAuthErrorMessageWebInternalError = @"An internal error has occurred " + "within the SFSafariViewController or UIWebView."; + /** @var kFIRAuthErrorMessageAppVerificationUserInteractionFailure @brief Message for @c FIRAuthErrorCodeInvalidClientID error code. */ @@ -494,6 +518,10 @@ static NSString *FIRAuthErrorDescription(FIRAuthErrorCode code) { return kFIRAuthErrorMessageInvalidClientID; case FIRAuthErrorCodeAppVerificationUserInteractionFailure: return kFIRAuthErrorMessageAppVerificationUserInteractionFailure; + case FIRAuthErrorCodeWebNetworkRequestFailed: + return kFIRAuthErrorMessageWebRequestFailed; + case FIRAuthErrorCodeWebInternalError: + return kFIRAuthErrorMessageWebInternalError; } } @@ -609,6 +637,10 @@ static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) { return @"ERROR_INVALID_CLIENT_ID"; case FIRAuthErrorCodeAppVerificationUserInteractionFailure: return @"ERROR_APP_VERIFICATION_FAILED"; + case FIRAuthErrorCodeWebNetworkRequestFailed: + return @"ERROR_WEB_NETWORK_REQUEST_FAILED"; + case FIRAuthErrorCodeWebInternalError: + return @"ERROR_WEB_INTERNAL_ERROR"; } } @@ -940,6 +972,12 @@ static NSString *const FIRAuthErrorCodeString(FIRAuthErrorCode code) { if ([code isEqualToString:kURLResponseErrorCodeInvalidClientID]) { return [self errorWithCode:FIRAuthInternalErrorCodeInvalidClientID message:message]; } + if ([code isEqualToString:kURLResponseErrorCodeNetworkRequestFailed]) { + return [self errorWithCode:FIRAuthInternalErrorCodeWebNetworkRequestFailed message:message]; + } + if ([code isEqualToString:kURLResponseErrorCodeInternalError]) { + return [self errorWithCode:FIRAuthInternalErrorCodeWebInternalError message:message]; + } return nil; } diff --git a/Firebase/Auth/Source/FIRAuthInternalErrors.h b/Firebase/Auth/Source/FIRAuthInternalErrors.h index 323fb51..d2905cc 100644 --- a/Firebase/Auth/Source/FIRAuthInternalErrors.h +++ b/Firebase/Auth/Source/FIRAuthInternalErrors.h @@ -343,6 +343,16 @@ typedef NS_ENUM(NSInteger, FIRAuthInternalErrorCode) { FIRAuthInternalErrorCodeInvalidClientID = FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeInvalidClientID, + /** Indicates that a network request within a SFSafariViewController or UIWebview failed. + */ + FIRAuthInternalErrorCodeWebNetworkRequestFailed = + FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeWebNetworkRequestFailed, + + /** Indicates that an internal error occured within a SFSafariViewController or UIWebview. + */ + FIRAuthInternalErrorCodeWebInternalError = + FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeWebInternalError, + // The enum values between 17046 and 17051 are reserved and should NOT be used for new error // codes. diff --git a/Firebase/Auth/Source/Public/FIRAuthErrors.h b/Firebase/Auth/Source/Public/FIRAuthErrors.h index 6b0d8bc..b70c87f 100644 --- a/Firebase/Auth/Source/Public/FIRAuthErrors.h +++ b/Firebase/Auth/Source/Public/FIRAuthErrors.h @@ -293,6 +293,14 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) { */ FIRAuthErrorCodeInvalidClientID = 17060, + /** Indicates that a network request within a SFSafariViewController or UIWebview failed. + */ + FIRAuthErrorCodeWebNetworkRequestFailed = 17061, + + /** Indicates that an internal error occured within a SFSafariViewController or UIWebview. + */ + FIRAuthErrorCodeWebInternalError = 17062, + /** Indicates an error occurred while attempting to access the keychain. */ FIRAuthErrorCodeKeychainError = 17995, |