aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Auth/Source/FIRAuthErrorUtils.m
diff options
context:
space:
mode:
authorGravatar Zsika Phillip <protocol86@users.noreply.github.com>2017-10-02 11:21:55 -0700
committerGravatar GitHub <noreply@github.com>2017-10-02 11:21:55 -0700
commit7fa0b0de42141d90b8ba3da67cad037becf6f065 (patch)
treeef7599978e5b7aee0731cd70f8f67edeae5c876f /Firebase/Auth/Source/FIRAuthErrorUtils.m
parentaebb293f3dcfaef012e847689d8b814477c0c301 (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/Source/FIRAuthErrorUtils.m')
-rw-r--r--Firebase/Auth/Source/FIRAuthErrorUtils.m38
1 files changed, 38 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;
}