From ff75b702f126522895581ae52fddbd91540af326 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Thu, 5 Nov 2020 19:35:42 +0200 Subject: [PATCH] Add more exception handling --- kdoorpi/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kdoorpi/__init__.py b/kdoorpi/__init__.py index d8be49c..0c6a4d7 100644 --- a/kdoorpi/__init__.py +++ b/kdoorpi/__init__.py @@ -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):