google / google/GoogleSignIn-iOS

Avoid Throwing Exceptions

未关闭
#548 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Objective-C
星标
750
派生
282
平均合并
2 天 15 小时
30 天内合并 PR
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 摘要。