diff options
Diffstat (limited to 'app/Controllers/updateController.php')
| -rw-r--r-- | app/Controllers/updateController.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 78f28e493..eeac7eb09 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -11,18 +11,19 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { /** * Automatic change to the new name of edge branch since FreshRSS 1.18.0. + * @throws Minz_Exception */ public static function migrateToGitEdge(): bool { $errorMessage = 'Error during git checkout to edge branch. Please change branch manually!'; if (!is_writable(FRESHRSS_PATH . '/.git/config')) { - throw new Exception($errorMessage); + throw new Minz_Exception($errorMessage); } //Note `git branch --show-current` requires git 2.22+ exec('git symbolic-ref --short HEAD', $output, $return); if ($return != 0) { - throw new Exception($errorMessage); + throw new Minz_Exception($errorMessage); } $line = implode('', $output); if ($line !== 'master' && $line !== 'dev') { @@ -33,13 +34,13 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { unset($output); exec('git checkout edge --guess -f', $output, $return); if ($return != 0) { - throw new Exception($errorMessage); + throw new Minz_Exception($errorMessage); } unset($output); exec('git reset --hard FETCH_HEAD', $output, $return); if ($return != 0) { - throw new Exception($errorMessage); + throw new Minz_Exception($errorMessage); } return true; @@ -64,6 +65,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { chdir(FRESHRSS_PATH); $output = []; try { + /** @throws ValueError */ exec('git fetch --prune', $output, $return); if ($return == 0) { $output = []; @@ -72,7 +74,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { $line = implode('; ', $output); Minz_Log::warning('git fetch warning: ' . $line); } - } catch (Exception $e) { + } catch (Throwable $e) { Minz_Log::warning('git fetch error: ' . $e->getMessage()); } chdir($cwd); @@ -101,11 +103,9 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { $output = []; self::migrateToGitEdge(); - } catch (Exception $e) { + } catch (Throwable $e) { Minz_Log::warning('Git error: ' . $e->getMessage()); - if (empty($output)) { - $output = $e->getMessage(); - } + $output = $e->getMessage(); $return = 1; } chdir($cwd); |
