error handling in daq

This commit is contained in:
appleb_m
2026-06-10 11:40:30 +02:00
parent 37ef7e8381
commit 1919c25874
+11 -6
View File
@@ -1372,7 +1372,7 @@ class AareDAQ:
event_type=SampleEventType.COLLECTIONFAILED,
additional_comment=f"JFJoch communication error: {e}"
)
return None
raise
except Exception as e:
logger.error(f"Rotation sequence failed: {e}")
self._handle_operation_error(
@@ -1381,7 +1381,7 @@ class AareDAQ:
error=e,
event_type=SampleEventType.COLLECTIONFAILED
)
return None
raise
def _append_smargon_trace(self, *, sample_id: int | None, event: str) -> None:
try:
@@ -2075,14 +2075,19 @@ class AareDAQ:
result = self._execute_rotation_sequence(request)
if result is None:
logger.error("Rotation scan failed, no result returned")
raise DataCollectionException("Rotation scan failed, no result returned")
self.__set_state(BeamlineStateEnum.SampleAlignment)
self.__cfg.state_busy = False
return result
except Exception as e:
self.__set_state(BeamlineStateEnum.SampleAlignment)
self.__cfg.state_busy = False
raise
finally:
try:
if self.__cfg.state_busy and self.__cfg.state != BeamlineStateEnum.Maintenance:
self.__set_state(BeamlineStateEnum.SampleAlignment)
except Exception as cleanup_error:
logger.exception(f"Failed to restore SampleAlignment after rotation: {cleanup_error}")
finally:
self.__cfg.state_busy = False
@property
def dtz(self) -> float: