Преглед изворни кода

tau: wrong due date exit with error instead assert

dasman пре 1 година
родитељ
комит
21ca366998
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      bin/tau/tau-python/tau

+ 3 - 1
bin/tau/tau-python/tau

@@ -145,7 +145,9 @@ def convert_attr_val(attr, val):
             sys.exit(-1)
             sys.exit(-1)
     elif attr == "due":
     elif attr == "due":
         # Other date formats not yet supported... ez to add
         # Other date formats not yet supported... ez to add
-        assert len(val) == 4
+        if len(val) != 4:
+            print(f"Error: due date must be of length 4 in mmyy format")
+            sys.exit(-1)
         date = datetime.now().date()
         date = datetime.now().date()
         year = int(date.strftime("%Y"))%100
         year = int(date.strftime("%Y"))%100
         try:
         try: