Skip to content

Commit

Permalink
Merge pull request #25446 from infinitered/lindboe/fix-gsi-logging
Browse files Browse the repository at this point in the history
Improve Google Sign In error logging
  • Loading branch information
Julesssss authored Oct 13, 2023
2 parents b5f94e9 + 7e18467 commit 9e19e40
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/SignInButtons/GoogleSignIn/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ function googleSignInRequest() {
.then((response) => response.idToken)
.then((token) => Session.beginGoogleSignIn(token))
.catch((error) => {
// Handle unexpected error shape
if (error === undefined || error.code === undefined) {
Log.alert(`[Google Sign In] Google sign in failed: ${error}`);
}
/** The logged code is useful for debugging any new errors that are not specifically handled. To decode, see:
- The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes
- The Google Sign In codes documentation: https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes
*/
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
Log.alert('[Google Sign In] Google sign in cancelled', true, {error});
} else if (error.code === statusCodes.IN_PROGRESS) {
Log.alert('[Google Sign In] Google sign in already in progress', true, {error});
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
Log.alert('[Google Sign In] Google play services not available or outdated', true, {error});
Log.info('[Google Sign In] Google Sign In cancelled');
} else {
Log.alert('[Google Sign In] Unknown Google sign in error', true, {error});
Log.alert(`[Google Sign In] Error Code: ${error.code}. ${error.message}`, {}, false);
}
});
}
Expand Down

0 comments on commit 9e19e40

Please sign in to comment.