diff --git a/src/Exceptions/GitFailedException.php b/src/Exceptions/GitFailedException.php index f2c3d7e..6e9921d 100644 --- a/src/Exceptions/GitFailedException.php +++ b/src/Exceptions/GitFailedException.php @@ -2,9 +2,9 @@ namespace Salahhusa9\Updater\Exceptions; -use Exception; +use RuntimeException; -class GitFailedException extends Exception +class GitFailedException extends RuntimeException { /** * GitFailedException constructor. diff --git a/src/Exceptions/GithubConfigException.php b/src/Exceptions/GithubConfigException.php index 6545f9e..89e8fe2 100644 --- a/src/Exceptions/GithubConfigException.php +++ b/src/Exceptions/GithubConfigException.php @@ -2,9 +2,9 @@ namespace Salahhusa9\Updater\Exceptions; -use Exception; +use RuntimeException; -class GithubConfigException extends Exception +class GithubConfigException extends RuntimeException { /** * GithubConfigException constructor. diff --git a/src/Pipelines/GitPipe.php b/src/Pipelines/GitPipe.php index b7fc3f9..b69b159 100644 --- a/src/Pipelines/GitPipe.php +++ b/src/Pipelines/GitPipe.php @@ -34,7 +34,7 @@ public function handle($content, Closure $next) call_user_func($content['output'], 'git checkout failed: '.$checkout); } - return throw new \Exception('git checkout failed: '.$checkout); + return throw new \RuntimeException('git checkout failed: '.$checkout); } else { if (is_callable($content['output'])) { call_user_func($content['output'], 'Checkout success'); diff --git a/src/RepositorySource/GithubRepository.php b/src/RepositorySource/GithubRepository.php index 64a8e46..82dd221 100644 --- a/src/RepositorySource/GithubRepository.php +++ b/src/RepositorySource/GithubRepository.php @@ -15,7 +15,7 @@ public function getLatestVersion(): string { $this->checkConfig(); - return isset($this->getLatestVersionData()['message']) ? throw new \Exception($this->getLatestVersionData()['message']) : $this->getLatestVersionData()['tag_name']; + return isset($this->getLatestVersionData()['message']) ? throw new \RuntimeException($this->getLatestVersionData()['message']) : $this->getLatestVersionData()['tag_name']; } /** @@ -48,7 +48,7 @@ public function getVersions(): array $versionsData = $this->getVersionsData(); if (isset($versionsData['message'])) { - throw new \Exception($versionsData['message']); + throw new \RuntimeException($versionsData['message']); } return $versionsData->map(function ($version) { diff --git a/src/Updater.php b/src/Updater.php index 0c9f192..4071d39 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -18,7 +18,7 @@ class Updater public function update(?callable $output = null): string { if (! is_null($output) and ! is_callable($output)) { - throw new \Exception('Output must be callable'); + throw new \RuntimeException('Output must be callable'); } $this->output = $output; @@ -97,11 +97,11 @@ private function updateTo($version): string if (is_array($pipelines) && count($pipelines) > 0) { foreach ($pipelines as $pipeline) { if (! is_subclass_of($pipeline, \Salahhusa9\Updater\Contracts\Pipeline::class)) { - throw new \Exception('Pipeline '.$pipeline.' is not implemented Pipeline contract:'.\Salahhusa9\Updater\Contracts\Pipeline::class); + throw new \RuntimeException('Pipeline '.$pipeline.' is not implemented Pipeline contract:'.\Salahhusa9\Updater\Contracts\Pipeline::class); } } } else { - throw new \Exception('Pipelines is not array or empty'); + throw new \RuntimeException('Pipelines is not array or empty'); } $this->output('Start Updating to version '.$version);