google / google/GoogleSignIn-iOS

Avoid Throwing Exceptions

Aperta
#548 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Objective-C
Stelle
750
Fork
282
Merge medio
2g 15h
PR unite (30g)
9

Descrizione

**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'.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.