From b8ff29c5927456dc91f703fb2455958aeb25a67a Mon Sep 17 00:00:00 2001 From: Axel Niklasson Date: Tue, 16 Feb 2021 11:33:06 +0100 Subject: [PATCH] Call config.onError if present if isReadyToPay throws --- src/lib/button-manager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/button-manager.ts b/src/lib/button-manager.ts index 6f9287b..6cb73ae 100644 --- a/src/lib/button-manager.ts +++ b/src/lib/button-manager.ts @@ -245,7 +245,11 @@ export class ButtonManager { || (readyToPay.result && readyToPay.paymentMethodPresent && this.config.existingPaymentMethodRequired) || false; } catch (err) { - console.error(err); + if (this.config.onError) { + this.config.onError(err) + } else { + console.error(err); + } } if (!this.isMounted()) return;