diff --git a/cli/src/core/exceptions.py b/cli/src/core/exceptions.py new file mode 100644 index 0000000..ba25cd0 --- /dev/null +++ b/cli/src/core/exceptions.py @@ -0,0 +1,4 @@ +class UVError(Exception): + """Raised when running uv yields an exception""" + + pass diff --git a/cli/src/core/service_creator.py b/cli/src/core/service_creator.py index 8efc064..72696db 100644 --- a/cli/src/core/service_creator.py +++ b/cli/src/core/service_creator.py @@ -1,12 +1,12 @@ import logging import shutil import subprocess -import sys from pathlib import Path import copier import git +from core.exceptions import UVError from core.git import ( assert_clean_repo, delete_local_branch, @@ -79,7 +79,11 @@ class ServiceCreator: registry_old.write_to_config() hla_names_old.write_to_config() switch_branch(repo, original_branch) - raise e + + if isinstance(e, UVError): + pass + else: + raise e def _render_new_service_templates( self, @@ -130,9 +134,9 @@ class ServiceCreator: logger.error( "The 'uv' command-line tool is not installed or not in your PATH.", ) - raise e + raise UVError from e except subprocess.CalledProcessError as e: logger.error("'uv lock' failed to execute successfully.") logger.error(f"Exit Code: {e.returncode}") logger.error(f"Details:\n{e.stderr}") - raise e + raise UVError from e