diff --git a/src/aare/daq/daq.py b/src/aare/daq/daq.py index 14aa8042..9ce793d2 100644 --- a/src/aare/daq/daq.py +++ b/src/aare/daq/daq.py @@ -1481,6 +1481,18 @@ class AareDAQ: value = self.__devs.tell.mount(address=target.tell_address(), force=True, auto_unmount=True, read_dm=False, wait=True, timeout=360.0) logger.debug(f"Mount response: {value.value}") + + if isinstance(value, str): + logger.error(f"Unexpected string response from Tell mount: {value}") + raise CriticalTellException(f"Critical error in TELL mount: unexpected response '{value}'") + + if value is None: + logger.error("Tell mount returned no response (None)") + raise CriticalTellException("Critical error in TELL mount: no response") + + safe_val = getattr(value, "value", str(value)) + logger.debug(f"Mount response: {safe_val}") + if value == TellEventValueEnum.NO_PIN_IN_GRIPPER: """No Pin in gripper is classed as a non critical mount fail Unless it happens multiple times in a row, in which case the mount fail handler should dry the gripper @@ -1499,10 +1511,13 @@ class AareDAQ: """Robot clear after mount, tell dry or tell cold are not fails, they are events telling the daq to allow automation to continue as the robot is busy but will not crash if the end station state is changed this allows us to save a lot of time in autoamtion""" - logger.info(f"Robot is {value.value} - freeing beamline for user") + logger.info(f"Robot is {getattr(value, 'value', str(value))} - freeing beamline for user") else: """Currently there are no other fail messages from Tell""" - logger.info(f"Mount response: {value.value} is not currently handled") + # Treat any unknown/unsupported event/value as critical for now + msg = f"Mount response not handled: {getattr(value, 'value', str(value))}" + logger.error(msg) + raise CriticalTellException(f"Critical error in TELL mount: {msg}") return def __mount(self, target: SampleShortInfo | None):