diff options
author | nico <nico@magicbroccoli.de> | 2020-08-06 13:26:04 +0200 |
---|---|---|
committer | nico <nico@magicbroccoli.de> | 2020-08-06 13:26:04 +0200 |
commit | bf49087072dcda8841b4a1084767c4fc1b0da68e (patch) | |
tree | 5d06c113be17135aed1dff385e0ba791c21c2db2 /cleanup.py | |
parent | 091b6e525aacad1abf8d800338d242141dec11c2 (diff) | |
parent | 0befdb44c27075c991515bbe50f53454fc5bc183 (diff) |
Merge branch 'exception' into 'master'
Bare exception handling
Closes #4 and #5
See merge request sum7/ejabberd-tools!7
Diffstat (limited to 'cleanup.py')
-rwxr-xr-x | cleanup.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |