From 0befdb44c27075c991515bbe50f53454fc5bc183 Mon Sep 17 00:00:00 2001 From: genofire Date: Sun, 19 Jul 2020 22:34:11 +0200 Subject: exception handling --- cleanup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cleanup.py') diff --git a/cleanup.py b/cleanup.py index 671c466..4956f94 100755 --- a/cleanup.py +++ b/cleanup.py @@ -38,11 +38,11 @@ class EjabberdCleanup(EjabberdApiCalls): lastdate = None try: lastdate = datetime.datetime.strptime(last_stamp, "%Y-%m-%dT%H:%M:%SZ") - except: # noqa: E722 + except ValueError: try: lastdate = datetime.datetime.strptime(last_stamp, "%Y-%m-%dT%H:%M:%S.%fZ") - except: # noqa: E722 - logging.error(f"{user}@{host}: not able to parse '{last_stamp}'") + except ValueError as err: + logging.error(f"{user}@{host}: not able to parse '{last_stamp}': {err}") return if lastdate is not None and lastdate - datetime.datetime.now() > datetime.timedelta( days=self.offline_since_days -- cgit v1.2.3-54-g00ecf