Skip to content
Snippets Groups Projects
Commit 5cda671c authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-333: CommClient.connect now does not return, but raises an exception upon...

L2SS-333: CommClient.connect now does not return, but raises an exception upon failure. This replaces using 'return True' and raising an exception.
parent d276d1cb
Branches
No related tags found
1 merge request!95L2SS-333: Improve CommClient.connect signature
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment