Skip to content

Commit

Permalink
Avoid exception when plugins details can't be fetched from October CM…
Browse files Browse the repository at this point in the history
…S market
  • Loading branch information
ChVuagniaux committed May 31, 2021
1 parent 72c3a3d commit 1e87296
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions controllers/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace OnePilot\Client\Controllers;

use Exception;
use Illuminate\Routing\Controller;
use Illuminate\Support\Collection;
use OnePilot\Client\Classes\Response;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1e87296

Please sign in to comment.