From 1e872969b69a12e88351f7c7690c08f8a88a9493 Mon Sep 17 00:00:00 2001 From: Christophe Vuagniaux Date: Mon, 31 May 2021 17:43:30 +0200 Subject: [PATCH] Avoid exception when plugins details can't be fetched from October CMS market --- controllers/Plugins.php | 13 +++++++++---- updates/version.yaml | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/controllers/Plugins.php b/controllers/Plugins.php index f0992d9..bdadb67 100644 --- a/controllers/Plugins.php +++ b/controllers/Plugins.php @@ -2,6 +2,7 @@ namespace OnePilot\Client\Controllers; +use Exception; use Illuminate\Routing\Controller; use Illuminate\Support\Collection; use OnePilot\Client\Classes\Response; @@ -40,7 +41,7 @@ public function update() $manager->downloadPlugin($code, $hash); $manager->extractPlugin($code, $hash); $manager->update(); - } catch (\Exception $e) { + } catch (Exception $e) { throw new OnePilotException('Error during plugin update', 500, $e); } @@ -110,9 +111,13 @@ private function getPluginsDetails($plugins) { $updateManager = UpdateManager::instance(); - $productsDetails = $updateManager->requestServerData('plugin/details', [ - 'names' => $plugins->pluck('code')->toArray(), - ]); + try { + $productsDetails = $updateManager->requestServerData('plugin/details', [ + 'names' => $plugins->pluck('code')->toArray(), + ]); + } catch (Exception $e) { + return collect(); + } return collect($productsDetails) ->filter(function ($item) { diff --git a/updates/version.yaml b/updates/version.yaml index 1e670d9..a381378 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -20,3 +20,5 @@ - Fix compatibility issues with October 472 1.1.0: - Add October v2 support, composer installation and possibility to disable update/install from 1Pilot +1.1.1: + - Avoid exception when plugins details can't be fetched from October CMS market