Browse Source

Refactor TemplateDraftError message construction for better readability

Co-authored-by: ChristianLempa <28359525+ChristianLempa@users.noreply.github.com>
copilot-swe-agent[bot] 2 tháng trước cách đây
mục cha
commit
26a79ccc09
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      cli/core/exceptions.py

+ 7 - 5
cli/core/exceptions.py

@@ -51,11 +51,13 @@ class TemplateDraftError(TemplateError):
     def __init__(self, template_id: str, module_name: str | None = None):
         self.template_id = template_id
         self.module_name = module_name
-        msg = f"Template '{template_id}' is in draft mode and not yet available for use"
-        if module_name:
-            msg += f" in module '{module_name}'"
-        msg += ".\nDraft templates are work-in-progress and cannot be generated yet."
-        msg += "\nTo get updates when published, run 'boilerplates repo update' to sync your library."
+
+        module_suffix = f" in module '{module_name}'" if module_name else ""
+        msg = (
+            f"Template '{template_id}' is in draft mode and not yet available for use{module_suffix}.\n"
+            "Draft templates are work-in-progress and cannot be generated yet.\n"
+            "To get updates when published, run 'boilerplates repo update' to sync your library."
+        )
         super().__init__(msg)