google / google/GoogleSignIn-iOS

Avoid Throwing Exceptions

Offen
#548 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Objective-C
Sterne
750
Forks
282
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.