Skip to content

Commit

Permalink
Handle connection error in init task
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJKoopman committed Oct 2, 2024
1 parent 1470e0a commit 6fc9d14
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion socs/agents/cryomech_cpa/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ def init(self, session, params=None):
fake_errors=self.fake_errors)

# Test connection and display identifying info
self.ptc.get_data()
try:
self.ptc.get_data()
except ConnectionError:
self.log.error("Could not establish connection to compressor.")
return False, "PTC agent initialization failed"
print("PTC Model:", self.ptc.model)
print("PTC Serial Number:", self.ptc.serial)
print("Software Revision is:", self.ptc.software_revision)
Expand Down

0 comments on commit 6fc9d14

Please sign in to comment.