GoogleSignIn-iOS icon indicating copy to clipboard operation
GoogleSignIn-iOS copied to clipboard

Avoid Throwing Exceptions

Open yuval-ngtnuma opened this issue 4 months ago • 2 comments

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 which in turn is aligned with Apple's Exception Programming Topics.

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 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 as well. Using exceptions is less informative for the client library, and is bound to become 'unhandled'.

yuval-ngtnuma avatar Aug 22 '25 21:08 yuval-ngtnuma

See also https://github.com/flutter/packages/pull/9486 - apparently fixed in later versions of the Flutter plugin, this is still expected to the an issue with any other consumer.

yuval-ngtnuma avatar Aug 22 '25 22:08 yuval-ngtnuma

Thanks for bringing this to our attention! You've made a great point about our use of exceptions for configuration errors. This is something I will bring up to the team, as it can help improve our library.

While we can't make any promises on if or when this will be adopted, we'll use this issue to track the suggestion. I'll keep this issue open so we can reference!

brnnmrls avatar Sep 13 '25 07:09 brnnmrls