Log exceptions

This commit is contained in:
nemunaire 2023-01-16 13:48:41 +01:00
commit 287c4ac349
3 changed files with 13 additions and 14 deletions

View file

@ -65,7 +65,9 @@ class SNCFAPI:
pass
if statinfo is None or datetime.fromtimestamp(statinfo.st_mtime, tz=timezone.utc) + timedelta(minutes=self.max_cache_timeout) < datetime.now(tz=timezone.utc):
raise Exception("File too old")
print(self.baseurl + "/1.0/infoVoy/rechercherListeCirculations?numero=%d&dateCirculation=%s&codeZoneArret&typeHoraire=TEMPS_REEL" % (int(numero), date.strftime("%Y-%m-%d")))
logging.exception(Exception("File too old to predict SNCF issue"))
return None
# Retrieve cached data
res = {}
@ -101,13 +103,10 @@ class SNCFAPI:
fd.write(f.read())
except ConnectionResetError as e:
logging.exception(e)
pass
except urllib.error.URLError as e:
logging.exception(e)
pass
except TimeoutError as e:
logging.exception(e)
pass
try:
statinfo = os.stat(cache_file)