From aeaef2a866f7458e2ae7e84d14430250c8271589 Mon Sep 17 00:00:00 2001 From: jevgenijvisockij Date: Wed, 3 Apr 2024 18:25:38 +0300 Subject: [PATCH] Adding error in case something goes wrong with PS accounts installation --- .../admin/AdminMollieSettingsController.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/controllers/admin/AdminMollieSettingsController.php b/controllers/admin/AdminMollieSettingsController.php index 22b79b81c..a7ffd7ad5 100644 --- a/controllers/admin/AdminMollieSettingsController.php +++ b/controllers/admin/AdminMollieSettingsController.php @@ -47,12 +47,16 @@ private function initCloudSyncAndPsAccounts(): bool $accountsFacade = $this->module->getService('Mollie.PsAccountsFacade'); $accountsService = $accountsFacade->getPsAccountsService(); } catch (PrestaShop\PsAccountsInstaller\Installer\Exception\InstallerException $e) { - $accountsInstaller = $this->module->getService('Mollie.PsAccountsInstaller'); - $accountsInstaller->install(); - $accountsFacade = $this->module->getService('Mollie.PsAccountsFacade'); - $accountsService = $accountsFacade->getPsAccountsService(); + try { + $accountsInstaller = $this->module->getService('Mollie.PsAccountsInstaller'); + $accountsInstaller->install(); + $accountsFacade = $this->module->getService('Mollie.PsAccountsFacade'); + $accountsService = $accountsFacade->getPsAccountsService(); + } catch (Exception $e) { + $this->context->controller->errors[] = $e->getMessage(); + return false; + } } - try { Media::addJsDef([ 'contextPsAccounts' => $accountsFacade->getPsAccountsPresenter()