cli: cleaner error handling
Deploy bin / deploy (push) Successful in 2s
Deploy, build and restart MASTER / deploy (push) Successful in 2s
Deploy agebd python package / deploy (push) Successful in 2s

This commit is contained in:
Benjamin Labrecque
2026-07-07 12:04:58 +02:00
parent fe2f7a5f91
commit 3a43a36f93
2 changed files with 12 additions and 4 deletions
+4
View File
@@ -0,0 +1,4 @@
class UVError(Exception):
"""Raised when running uv yields an exception"""
pass
+8 -4
View File
@@ -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