diff --git a/devices/clients/comms_client.py b/devices/clients/comms_client.py index 6aa52ae42bf7bd9a2a22b2661784696fa95cbc74..2aa9c661f11c255352b5af412f72b86cb5af32fc 100644 --- a/devices/clients/comms_client.py +++ b/devices/clients/comms_client.py @@ -35,7 +35,11 @@ class CommClient(Thread): def run(self): # Explicitly connect - if not self.connect(): + try: + self.connect(): + except Exception as e: + self.streams.error_stream("Fault condition in communication detected.", e) + # hardware or infra is down -- needs fixing first self.fault_func() return diff --git a/devices/test/clients/test_client.py b/devices/test/clients/test_client.py index 355b4f72ad8d6c61c6655b45b75a9f597ac6b72c..c8e564ca71434f6445bc496a982a398fdc50fba7 100644 --- a/devices/test/clients/test_client.py +++ b/devices/test/clients/test_client.py @@ -21,10 +21,7 @@ class test_client(CommClient): super().__init__(fault_func, streams, try_interval) # Explicitly connect - if not self.connect(): - # hardware or infra is down -- needs fixing first - fault_func() - return + self.connect() def connect(self): """ @@ -33,7 +30,6 @@ class test_client(CommClient): self.streams.debug_stream("the example client doesn't actually connect to anything silly") self.connected = True # set connected to true - return True # if succesfull, return true. otherwise return false def disconnect(self): self.connected = False # always force a reconnect, regardless of a successful disconnect