Skip to content

Commit

Permalink
fix: trigger onError callback when loading googlepay js faild
Browse files Browse the repository at this point in the history
  • Loading branch information
shirly-chen-awx authored and dmengelt committed Dec 5, 2022
1 parent 73daa32 commit e06dcf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ yarn-error.log*

*.orig
.env

.history
.bit/
.bitmap
13 changes: 11 additions & 2 deletions src/lib/button-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,18 @@ export class ButtonManager {
}

async mount(element: Element): Promise<void> {
if (!this.isGooglePayLoaded()) {
await loadScript('https://pay.google.com/gp/p/js/pay.js');
try {
if (!this.isGooglePayLoaded()) {
await loadScript('https://pay.google.com/gp/p/js/pay.js');
}
} catch(err) {
if (this.config?.onError) {
this.config.onError(err as Error);
} else {
console.error(err);
}
}


this.element = element;
if (element) {
Expand Down

0 comments on commit e06dcf7

Please sign in to comment.