- Removed unused exception GitTagsException in \ncc\Exceptions in favor of GitException

This commit is contained in:
Netkas 2023-08-19 12:56:31 -04:00
parent 00dcc7e004
commit 85d4a63248
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
5 changed files with 5 additions and 51 deletions

View file

@ -120,6 +120,7 @@ features.
- Removed unused exception `GitCloneException` in `\ncc\Exceptions` in favor of `GitException` - 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 `GitCheckoutException` in `\ncc\Exceptions` in favor of `GitException`
- Removed unused exception `GithubServiceException` 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`

View file

@ -56,7 +56,7 @@ GitException
* GIT_CHECKOUT_EXCEPTION * GIT_CHECKOUT_EXCEPTION
* GITHUB_SERVICE_EXCEPTION * GITHUB_SERVICE_EXCEPTION
GITLAB_SERVICE_EXCEPTION GITLAB_SERVICE_EXCEPTION
GIT_TAGS_EXCEPTION * GIT_TAGS_EXCEPTION
ArchiveException ArchiveException
UNSUPPORTED_ARCHIVE UNSUPPORTED_ARCHIVE

View file

@ -23,7 +23,6 @@
namespace ncc\Classes; namespace ncc\Classes;
use ncc\Exceptions\GitException; use ncc\Exceptions\GitException;
use ncc\Exceptions\GitTagsException;
use ncc\ThirdParty\Symfony\Process\Process; use ncc\ThirdParty\Symfony\Process\Process;
use ncc\Utilities\Console; use ncc\Utilities\Console;
use ncc\Utilities\Functions; use ncc\Utilities\Functions;
@ -123,7 +122,7 @@
* *
* @param string $path * @param string $path
* @return array * @return array
* @throws GitTagsException * @throws GitException
*/ */
public static function getTags(string $path): array public static function getTags(string $path): array
{ {
@ -137,11 +136,10 @@
if (!$process->isSuccessful()) 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 = new Process(['git', '--no-pager', 'tag', '-l'] , $path);
$process->run(function ($type, $buffer) $process->run(function ($type, $buffer)
{ {
Console::outVerbose($buffer); Console::outVerbose($buffer);
@ -149,7 +147,7 @@
if (!$process->isSuccessful()) 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()); $tags = explode(PHP_EOL, $process->getOutput());

View file

@ -294,11 +294,6 @@ namespace ncc\Enums;
*/ */
public const IMPORT_EXCEPTION = -1757; public const IMPORT_EXCEPTION = -1757;
/**
* @see GitTagsException
*/
public const GIT_TAGS_EXCEPTION = -1758;
/** /**
* @see AuthenticationException * @see AuthenticationException
*/ */
@ -408,7 +403,6 @@ namespace ncc\Enums;
self::HTTP_EXCEPTION, self::HTTP_EXCEPTION,
self::UNSUPPORTED_REMOTE_SOURCE_TYPE, self::UNSUPPORTED_REMOTE_SOURCE_TYPE,
self::GITLAB_SERVICE_EXCEPTION, self::GITLAB_SERVICE_EXCEPTION,
self::GIT_TAGS_EXCEPTION,
self::AUTHENTICATION_EXCEPTION, self::AUTHENTICATION_EXCEPTION,
self::NOT_SUPPORTED_EXCEPTION, self::NOT_SUPPORTED_EXCEPTION,
self::UNSUPPORTED_PROJECT_TYPE, self::UNSUPPORTED_PROJECT_TYPE,

View file

@ -1,39 +0,0 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, all rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace ncc\Exceptions;
use Exception;
use ncc\Enums\ExceptionCodes;
use Throwable;
class GitTagsException extends Exception
{
/**
* @param string $message
* @param Throwable|null $previous
*/
public function __construct(string $message = "", ?Throwable $previous = null)
{
parent::__construct($message, ExceptionCodes::GIT_TAGS_EXCEPTION, $previous);
}
}