From 27aa8f9875f2882370a56e3a01b72d0803f0f42e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 6 Dec 2019 21:04:52 +0100 Subject: [PATCH] Handled rename tag error from command --- module/CLI/src/Command/Tag/RenameTagCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/CLI/src/Command/Tag/RenameTagCommand.php b/module/CLI/src/Command/Tag/RenameTagCommand.php index 3e9f021b..1638108a 100644 --- a/module/CLI/src/Command/Tag/RenameTagCommand.php +++ b/module/CLI/src/Command/Tag/RenameTagCommand.php @@ -6,6 +6,7 @@ namespace Shlinkio\Shlink\CLI\Command\Tag; use Shlinkio\Shlink\CLI\Util\ExitCodes; use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException; +use Shlinkio\Shlink\Core\Exception\TagConflictException; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -50,6 +51,11 @@ class RenameTagCommand extends Command } catch (EntityDoesNotExistException $e) { $io->error(sprintf('A tag with name "%s" was not found', $oldName)); return ExitCodes::EXIT_FAILURE; + } catch (TagConflictException $e) { + $io->error( + sprintf('A tag with name "%s" cannot be renamed to "%s" because it already exists', $oldName, $newName) + ); + return ExitCodes::EXIT_FAILURE; } } }