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

@ -1,6 +1,7 @@
from datetime import datetime, timedelta, timezone
import hashlib
import json
import logging
import os
import urllib.parse
import urllib.request
@ -97,12 +98,12 @@ class IDFMAPI:
with urllib.request.urlopen(req) as f:
with open(cache_file, 'wb') as fd:
fd.write(f.read())
except ConnectionResetError:
pass
except urllib.error.URLError:
pass
except urllib.error.HTTPError:
pass
except ConnectionResetError as e:
logging.exception(e)
except urllib.error.URLError as e:
logging.exception(e)
except urllib.error.HTTPError as e:
logging.exception(e)
with open(cache_file) as f:
res = json.load(f)