Skip to content

Commit b47c65b

Browse files
author
Mohamed Zeidan
committed
create command handled differnelt
1 parent 08a9c45 commit b47c65b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/sagemaker/hyperpod/common/cli_decorators.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,22 @@ def _generate_context_aware_error_message(target_type: str, target_name: str, di
326326
)
327327

328328
def _generate_namespace_error_message(namespace: str, func) -> str:
329-
"""Generate helpful error message for non-existent namespace with list command."""
330-
raw_resource_type, display_name = _extract_resource_from_command(func)
331-
list_command = _get_list_command_from_resource_type(raw_resource_type)
332-
333-
return (
334-
f"❌ Namespace '{namespace}' does not exist on this cluster. "
335-
f"Use '{list_command}' to check for available resources."
336-
)
329+
"""Generate helpful error message for non-existent namespace - context-aware for create vs other operations."""
330+
# Check if this is a create operation
331+
if _is_create_operation(func):
332+
return (
333+
f"❌ Namespace '{namespace}' does not exist on this cluster. "
334+
f"Please create the namespace first or use an existing namespace."
335+
)
336+
else:
337+
# For describe/delete/list operations, suggest checking for resources
338+
raw_resource_type, display_name = _extract_resource_from_command(func)
339+
list_command = _get_list_command_from_resource_type(raw_resource_type)
340+
341+
return (
342+
f"❌ Namespace '{namespace}' does not exist on this cluster. "
343+
f"Use '{list_command}' to check for available resources."
344+
)
337345

338346
def _extract_resource_from_command(func) -> tuple[str, str]:
339347
"""

0 commit comments

Comments
 (0)