diff options
-rwxr-xr-x | debdate | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -34,6 +34,7 @@ RELEASES = [ (datetime.date(1996, 6, 17), 'buzz'), ] MSG = "Today is day {dody} of year {yodr} of the {release}" +ERR_MSG = "Today is {isodate} of the Debianless Age" class DebDate: @@ -160,8 +161,12 @@ class Command: else: date = datetime.date.today() debdate = DebDate() - data = debdate.get_release(date) - print(MSG.format(**data)) + try: + data = debdate.get_release(date) + except OutsideTimeError: + print(ERR_MSG.format(isodate=date.strftime("%Y-%m-%d"))) + else: + print(MSG.format(**data)) def main(self): self.setup_parser() |