From bc57ccba99a113c803c3eb3f7c209cd5f499975a Mon Sep 17 00:00:00 2001 From: Serhii Koval Date: Thu, 16 Jan 2025 10:29:18 +0100 Subject: [PATCH] Show correct error in console when SDK is not loaded For countries where SDK is blocked there is no document.logBreadIssue method. This causes an error. We can handle it and show the correct error in the console. --- view/frontend/templates/breadcheckout/view.phtml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/view/frontend/templates/breadcheckout/view.phtml b/view/frontend/templates/breadcheckout/view.phtml index 022debb..2f83340 100644 --- a/view/frontend/templates/breadcheckout/view.phtml +++ b/view/frontend/templates/breadcheckout/view.phtml @@ -114,7 +114,11 @@ let errorInfo = { err: 'err' }; - document.logBreadIssue('error', errorInfo, 'Instance of Bread Payments SDK does not exist'); + try { + document.logBreadIssue('error', errorInfo, 'Instance of Bread Payments SDK does not exist'); + } catch (error) { + console.error('Instance of Bread Payments SDK does not exist'); + } } }; @@ -491,4 +495,4 @@ }); }); - \ No newline at end of file +