Add more exception handling

This commit is contained in:
Arti Zirk 2020-11-05 19:35:42 +02:00
parent d9f578d0a9
commit ff75b702f1
1 changed files with 7 additions and 1 deletions

View File

@ -63,6 +63,8 @@ class Main:
logging.exception("Failed to decode allowed uids json")
except (requests.Timeout, requests.ConnectionError) as e:
logging.exception("Connection timeout/error in sync cards")
except Exception:
logging.exception("Some other exception")
else:
uids = set()
for token in allowed_uids:
@ -92,6 +94,8 @@ class Main:
requests.post(self.api_swipe, data=data, timeout=15)
except (requests.Timeout, requests.ConnectionError) as e:
logging.exception("Connection timeout/error in post swipes")
except Exception:
logging.exception("Some other exception")
def listen_notification(self):
while 1:
@ -110,7 +114,9 @@ class Main:
except (requests.Timeout,
requests.ConnectionError) as e:
logging.debug("notification timeout")
time.sleep(0.1)
except Exception:
logging.exception("Some other exception")
time.sleep(0.1)
def auto_sync_loop(self):