mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Handled rename tag error from command
This commit is contained in:
@@ -6,6 +6,7 @@ namespace Shlinkio\Shlink\CLI\Command\Tag;
|
|||||||
|
|
||||||
use Shlinkio\Shlink\CLI\Util\ExitCodes;
|
use Shlinkio\Shlink\CLI\Util\ExitCodes;
|
||||||
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\TagConflictException;
|
||||||
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
@@ -50,6 +51,11 @@ class RenameTagCommand extends Command
|
|||||||
} catch (EntityDoesNotExistException $e) {
|
} catch (EntityDoesNotExistException $e) {
|
||||||
$io->error(sprintf('A tag with name "%s" was not found', $oldName));
|
$io->error(sprintf('A tag with name "%s" was not found', $oldName));
|
||||||
return ExitCodes::EXIT_FAILURE;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user