fix: return 0 if ring current device is not accessible #119

Merged
perl_d merged 1 commits from fix/handle_no_ring_current into main 2026-07-27 16:13:26 +02:00
+6 -1
View File
@@ -9,6 +9,7 @@ from aarecommon.errors.exception_handler import BECCommunicationError
from aarecommon.models.beamline import MXBeamline
from bec_ipython_client import BECIPythonClient
from bec_ipython_client.signals import OperationMode
from bec_lib.device import RPCError, ScanRequestError
from bec_lib.procedures.helper import FrontendProcedureHelper
from bec_lib.service_config import ServiceConfig
@@ -527,7 +528,11 @@ class BECClientWorker:
@property
def ring_current(self) -> float:
return self._ring_current.get()
try:
return self._ring_current.get()
except (RPCError, ScanRequestError) as e:
logger.warning(f"Ring current BEC device is not available: {e}")
return 0
if __name__ == "__main__":