This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
[google_sign_in_web] Ensure web plugin throws PlatformExceptions #2943
Merged
ditman
merged 12 commits into
flutter:master
from
ditman:google-sign-in-swallowed-errors
Sep 14, 2020
Merged
[google_sign_in_web] Ensure web plugin throws PlatformExceptions #2943
ditman
merged 12 commits into
flutter:master
from
ditman:google-sign-in-swallowed-errors
Sep 14, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cyanglaz
reviewed
Aug 19, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we test this?
@cyanglaz I need to migrate the tests to e2e first, but I can shave that yak for this PR, yes. (Main goal of publishing this early was for people affected by the bugs above to try this branch and see if their apps behave better) |
ditman
changed the title
[google_sign_in_web] Ensure web plugin throws PlatformExceptions
[google_sign_in_web] [WIP] Ensure web plugin throws PlatformExceptions
Aug 19, 2020
ditman
force-pushed
the
google-sign-in-swallowed-errors
branch
2 times, most recently
from
August 24, 2020 23:53
bb6b758
to
3ab3c4c
Compare
@cyanglaz I've migrated the tests to run as |
ditman
changed the title
[google_sign_in_web] [WIP] Ensure web plugin throws PlatformExceptions
[google_sign_in_web] Ensure web plugin throws PlatformExceptions
Aug 25, 2020
This was referenced Aug 25, 2020
cyanglaz
reviewed
Sep 11, 2020
packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
Outdated
Show resolved
Hide resolved
This type is the parameter type passed to the `onFailure` callback of the `auth` promise. This makes auth exceptions more predictable in profile/release mode.
Throw a PlatformException when the signIn() method fails, instead of letting it throw a raw JS Object.
ditman
force-pushed
the
google-sign-in-swallowed-errors
branch
from
September 11, 2020 19:17
ef919a0
to
80663d0
Compare
cyanglaz
reviewed
Sep 11, 2020
packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
Outdated
Show resolved
Hide resolved
cyanglaz
approved these changes
Sep 12, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Published v0.9.2. |
danielroek
pushed a commit
to Baseflow/flutter-plugins
that referenced
this pull request
Sep 18, 2020
…#2943) Instead of throwing JS objects, or attempting to access undefined properties. This change also migrates tests to the `integration_test` package.
jorgefspereira
pushed a commit
to jorgefspereira/plugins_flutter
that referenced
this pull request
Oct 10, 2020
…#2943) Instead of throwing JS objects, or attempting to access undefined properties. This change also migrates tests to the `integration_test` package.
FlutterSu
pushed a commit
to FlutterSu/flutter-plugins
that referenced
this pull request
Nov 20, 2020
…#2943) Instead of throwing JS objects, or attempting to access undefined properties. This change also migrates tests to the `integration_test` package.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The web version of the plugin wasn't very good at throwing exceptions:
init()
weren't being unpacked correctly inrelease
orprofile
mode, because of a missing JS-interop class. This prevented the code from throwing a proper PlatformException.signIn()
were being rethrown as JS Objects, instead of wrapping them correctly in a PlatformException.This PR ensures that the methods above throw the appropriate exception every time, regardless of the environment (dev vs release).
This PR also aligns the fields of the PlatformException with those coming from the mobile side, so:
PlatformException.code
is now what the Google Sign In SDK calls"error"
..message
is now what the Google Sign In SDK calls"details"
(when available)..details
is'google_sign_in'
See multiple "Error Codes" here: https://developers.google.com/identity/sign-in/web/reference#error_codes
Finally, the tests on the package have been migrated to run with
flutter drive
+chromedriver
instead of other options.Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?