Skip to content

fix: call config.onError if present if isReadyToPay throws#73

Merged
socsieng merged 2 commits intogoogle-pay:mainfrom
axelniklasson:main
Feb 17, 2021
Merged

fix: call config.onError if present if isReadyToPay throws#73
socsieng merged 2 commits intogoogle-pay:mainfrom
axelniklasson:main

Conversation

@axelniklasson
Copy link
Contributor

Currently if the isReadyToPay throws when setting up the Google Pay button, the onError callback is not called and the error is printed out in console through console.error instead. This PR adds support for triggering the onError callback if present and otherwise fallback to the existing behaviour.

@socsieng
Copy link
Collaborator

Thanks for the PR. Can you include repro steps you used to trigger the error?

@axelniklasson
Copy link
Contributor Author

Sure!

  1. Serve any page embedding the React button locally over an insecure context (such as your local IP)
  2. When rendering it crashes and the error message DEVELOPER_ERROR in isReadyToPay: Google Pay APIs should be called in secure context! is printed in the console
  3. The onError callback of the React component is not triggered

@socsieng socsieng merged commit 63fee4f into google-pay:main Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants