ソースを参照

better invalid date error message
This is more likely to occur when getting the constraint columns in the wrong
order than any other kind of user or programming error, so a vanilla error
message is more useful than a stack trace here.

Justin Tracey 4 年 前
コミット
ceb37164ec
1 ファイル変更5 行追加1 行削除
  1. 5 1
      vice-speaker-rotator.py

+ 5 - 1
vice-speaker-rotator.py

@@ -13,7 +13,11 @@ https://cs.uwaterloo.ca/twiki/view/CrySP/UpcomingEvents
 """
 
 def str_to_date(string_date):
-    return date(*[int(s) for s in string_date.split('-')])
+    try:
+        return date(*[int(s) for s in string_date.split('-')])
+    except:
+        print("invalid date: " + string_date)
+        sys.exit()
 
 class CryspCalendar:
     """Representation of a CrySP weekly meeting schedule for a term"""