Add more exception handling
This commit is contained in:
parent
d9f578d0a9
commit
ff75b702f1
@ -63,6 +63,8 @@ class Main:
|
|||||||
logging.exception("Failed to decode allowed uids json")
|
logging.exception("Failed to decode allowed uids json")
|
||||||
except (requests.Timeout, requests.ConnectionError) as e:
|
except (requests.Timeout, requests.ConnectionError) as e:
|
||||||
logging.exception("Connection timeout/error in sync cards")
|
logging.exception("Connection timeout/error in sync cards")
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Some other exception")
|
||||||
else:
|
else:
|
||||||
uids = set()
|
uids = set()
|
||||||
for token in allowed_uids:
|
for token in allowed_uids:
|
||||||
@ -92,6 +94,8 @@ class Main:
|
|||||||
requests.post(self.api_swipe, data=data, timeout=15)
|
requests.post(self.api_swipe, data=data, timeout=15)
|
||||||
except (requests.Timeout, requests.ConnectionError) as e:
|
except (requests.Timeout, requests.ConnectionError) as e:
|
||||||
logging.exception("Connection timeout/error in post swipes")
|
logging.exception("Connection timeout/error in post swipes")
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Some other exception")
|
||||||
|
|
||||||
def listen_notification(self):
|
def listen_notification(self):
|
||||||
while 1:
|
while 1:
|
||||||
@ -110,7 +114,9 @@ class Main:
|
|||||||
except (requests.Timeout,
|
except (requests.Timeout,
|
||||||
requests.ConnectionError) as e:
|
requests.ConnectionError) as e:
|
||||||
logging.debug("notification timeout")
|
logging.debug("notification timeout")
|
||||||
time.sleep(0.1)
|
except Exception:
|
||||||
|
logging.exception("Some other exception")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
def auto_sync_loop(self):
|
def auto_sync_loop(self):
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user