Browse Source

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 3 years ago
parent
commit
ceb37164ec
1 changed files with 5 additions and 1 deletions
  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"""