Log exceptions
This commit is contained in:
parent
9d625c87ee
commit
287c4ac349
3 changed files with 13 additions and 14 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue