google / google/GoogleSignIn-iOS

Avoid Throwing Exceptions

オープン
#548 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Objective-C
スター
750
フォーク
282
平均マージ
2日 15時間
マージ済み PR(30日)
9

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。