diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b5099c..87f28bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,6 +120,7 @@ features. - Removed unused exception `GitCloneException` in `\ncc\Exceptions` in favor of `GitException` - Removed unused exception `GitCheckoutException` in `\ncc\Exceptions` in favor of `GitException` - Removed unused exception `GithubServiceException` in `\ncc\Exceptions` in favor of `GitException` + - Removed unused exception `GitTagsException` in `\ncc\Exceptions` in favor of `GitException` diff --git a/scratch/exceptions_plan.txt b/scratch/exceptions_plan.txt index 3246b94..901aee0 100644 --- a/scratch/exceptions_plan.txt +++ b/scratch/exceptions_plan.txt @@ -56,7 +56,7 @@ GitException * GIT_CHECKOUT_EXCEPTION * GITHUB_SERVICE_EXCEPTION GITLAB_SERVICE_EXCEPTION - GIT_TAGS_EXCEPTION + * GIT_TAGS_EXCEPTION ArchiveException UNSUPPORTED_ARCHIVE diff --git a/src/ncc/Classes/GitClient.php b/src/ncc/Classes/GitClient.php index 2fa57ae..778fc68 100644 --- a/src/ncc/Classes/GitClient.php +++ b/src/ncc/Classes/GitClient.php @@ -23,7 +23,6 @@ namespace ncc\Classes; use ncc\Exceptions\GitException; - use ncc\Exceptions\GitTagsException; use ncc\ThirdParty\Symfony\Process\Process; use ncc\Utilities\Console; use ncc\Utilities\Functions; @@ -123,7 +122,7 @@ * * @param string $path * @return array - * @throws GitTagsException + * @throws GitException */ public static function getTags(string $path): array { @@ -137,11 +136,10 @@ if (!$process->isSuccessful()) { - throw new GitTagsException($process->getErrorOutput()); + throw new GitException(sprintf('Failed to fetch tags in repository %s: %s', $path, $process->getErrorOutput())); } $process = new Process(['git', '--no-pager', 'tag', '-l'] , $path); - $process->run(function ($type, $buffer) { Console::outVerbose($buffer); @@ -149,7 +147,7 @@ if (!$process->isSuccessful()) { - throw new GitTagsException($process->getErrorOutput()); + throw new GitException(sprintf('Failed to get tags in repository %s: %s', $path, $process->getErrorOutput())); } $tags = explode(PHP_EOL, $process->getOutput()); diff --git a/src/ncc/Enums/ExceptionCodes.php b/src/ncc/Enums/ExceptionCodes.php index 2d67772..4bcb0c7 100644 --- a/src/ncc/Enums/ExceptionCodes.php +++ b/src/ncc/Enums/ExceptionCodes.php @@ -294,11 +294,6 @@ namespace ncc\Enums; */ public const IMPORT_EXCEPTION = -1757; - /** - * @see GitTagsException - */ - public const GIT_TAGS_EXCEPTION = -1758; - /** * @see AuthenticationException */ @@ -408,7 +403,6 @@ namespace ncc\Enums; self::HTTP_EXCEPTION, self::UNSUPPORTED_REMOTE_SOURCE_TYPE, self::GITLAB_SERVICE_EXCEPTION, - self::GIT_TAGS_EXCEPTION, self::AUTHENTICATION_EXCEPTION, self::NOT_SUPPORTED_EXCEPTION, self::UNSUPPORTED_PROJECT_TYPE, diff --git a/src/ncc/Exceptions/GitTagsException.php b/src/ncc/Exceptions/GitTagsException.php deleted file mode 100644 index 1fa5dc1..0000000 --- a/src/ncc/Exceptions/GitTagsException.php +++ /dev/null @@ -1,39 +0,0 @@ -