فهرست منبع

tau: print and error and exxit if attributes are invalid, instead of assert

dasman 2 سال پیش
والد
کامیت
273a046b8a
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      bin/tau/tau-python/tau

+ 4 - 3
bin/tau/tau-python/tau

@@ -108,9 +108,10 @@ def prompt_comment_text():
     ])
     ])
 
 
 def set_task_attr(task, attr, val):
 def set_task_attr(task, attr, val):
-    # templ = lib.util.task_template
-    assert attr in ["desc", "rank", "due", "project"]
-    # assert templ[attr] != list
+    if attr not in ["desc", "rank", "due", "project"]:
+        print(f"Error: invalid attribute: {attr} {val}")
+        print("Task is not added")
+        exit(-1)
 
 
     if val.lower() == "none":
     if val.lower() == "none":
         task[attr] = None
         task[attr] = None