Skip to content

Commit 4d0ab73

Browse files
refactor(cli): update package errors to use report_error
1 parent 8021ba2 commit 4d0ab73

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

hatch/cli/cli_package.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def handle_package_remove(args: Namespace) -> int:
100100
reporter.report_result()
101101
return EXIT_SUCCESS
102102
else:
103-
print(f"[ERROR] Failed to remove package: {package_name}")
103+
reporter.report_error(f"Failed to remove package '{package_name}'")
104104
return EXIT_ERROR
105105

106106

@@ -376,7 +376,7 @@ def handle_package_add(args: Namespace) -> int:
376376
refresh_registry,
377377
auto_approve,
378378
):
379-
print(f"[ERROR] Failed to add package: {package_path_or_name}")
379+
reporter.report_error(f"Failed to add package '{package_path_or_name}'")
380380
return EXIT_ERROR
381381

382382
# Handle MCP host configuration if requested
@@ -497,7 +497,9 @@ def handle_package_sync(args: Namespace) -> int:
497497
print(f"Warning: Could not get MCP configuration for package '{pkg_name}': {e}")
498498

499499
if not server_configs:
500-
print(f"[ERROR] No MCP server configurations found for package '{package_name}' or its dependencies")
500+
reporter.report_error(
501+
f"No MCP server configurations found for package '{package_name}' or its dependencies"
502+
)
501503
return EXIT_ERROR
502504

503505
# Build consequences for preview/confirmation
@@ -553,5 +555,5 @@ def handle_package_sync(args: Namespace) -> int:
553555
return EXIT_ERROR
554556

555557
except ValueError as e:
556-
print(f"[ERROR] {e}")
558+
reporter.report_error(str(e))
557559
return EXIT_ERROR

0 commit comments

Comments
 (0)