google / google/GoogleSignIn-iOS

Avoid Throwing Exceptions

Ouverte
#548 2 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Objective-C
Étoiles
750
Forks
282
Merge moyen
2 j 15 h
PR mergées (30 j)
9

Description

**Is your feature request related to a problem you're having? Please describe.**
`GoogleSignIn/Sources/GIDSignIn.m` is the only place that exposes exceptions. This is done in contrast to the [Google style guide](https://google.github.io/styleguide/objcguide.html#avoid-throwing-exceptions) which in turn is aligned with Apple's [Exception Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Exceptions/Exceptions.html).

**Describe the solution you'd like**
Instead, error objects should be used: `you should take care to catch such exceptions at the top level of the library and translate them into an appropriate return code or state`. [Clang](https://clang.llvm.org/extra/clang-tidy/checks/google/objc-avoid-throwing-exception.html) for instance pass a `**NSError` and return a BOOL.

**Describe alternatives you've considered**
N/A

**Additional context**
I am receiving crashes for Google Sign-In iOS plugin for Flutter, and it seems to be the case for [react-native](https://github.com/react-native-google-signin/google-signin/issues/1231) as well. Using exceptions is less informative for the client library, and is bound to become 'unhandled'.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.