jfjoch: exception catching.

This commit is contained in:
2026-05-20 11:47:53 +02:00
parent 3679e70a51
commit 6857275a13
+25 -3
View File
@@ -238,12 +238,34 @@ class JFJochWrapper:
)
def detector(self) -> jfjoch_client.models.DetectorListElement:
l = self.__api.config_select_detector_get()
try:
l = self.__api.config_select_detector_get()
except Exception as e:
self._raise_jfjoch_error(
f"JFJoch detector configuration retrieval failed: {e}",
error=e,
operation="GET",
endpoint="config_select_detector_get",
)
if len(l.detectors) == 0:
raise Exception("no detectors configured")
raise JFJochCommunicationError(
"JFJoch returned no configured detectors",
operation="GET",
endpoint="config_select_detector_get",
base_url=self.__url,
status_code=None,
)
return l.detectors[l.current_id]
try:
return l.detectors[l.current_id]
except Exception as e:
self._raise_jfjoch_error(
"JFJoch returned an invalid selected detector entry",
error=e,
operation="GET",
endpoint="config_select_detector_get",
)
def get_diffraction_image(self, image_id: int, wait_between_retries_s: float = 0.1):
last_error = None