🔊 Console error when button init fails

This commit is contained in:
Philipp Stracker 2024-08-12 17:38:43 +02:00
parent e80b81da72
commit 843403cbdc
No known key found for this signature in database

View file

@ -59,9 +59,18 @@ class GooglepayManager {
this.transactionInfo = await this.fetchTransactionInfo();
}
for ( const button of this.buttons ) {
button.configure( this.googlePayConfig, this.transactionInfo );
button.init();
if ( ! this.googlePayConfig ) {
console.error( 'No GooglePayConfig received during init' );
} else if ( ! this.transactionInfo ) {
console.error( 'No transactionInfo found during init' );
} else {
for ( const button of this.buttons ) {
button.configure(
this.googlePayConfig,
this.transactionInfo
);
button.init();
}
}
} catch ( error ) {
console.error( 'Error during initialization:', error );