From 8434e8de35a7a8c09dbcd868af41c578bf34a406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr>
Date: Thu, 1 Feb 2024 15:04:19 +0100
Subject: [PATCH] fix: Add try/except on watcher init

* It did not work last time, try to see why
---
 FofbTool/Utils.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/FofbTool/Utils.py b/FofbTool/Utils.py
index 1e40081..458d600 100644
--- a/FofbTool/Utils.py
+++ b/FofbTool/Utils.py
@@ -53,17 +53,27 @@ def init_watcher():
     Run init on Fofb-Watcher, waiting for its completion then init on the FofbCommand.
     """
 
-    wprx=tango.DeviceProxy(tangopath["fofb-watcher"])
-    wprx.set_timeout_millis(30000)
+    try:
+        wprx=tango.DeviceProxy(tangopath["fofb-watcher"])
+        wprx.set_timeout_millis(30000)
+    except tango.DevFailed as e:
+            logger.error("Could not get DeviceProxy on {}".format(tangopath["fofb-watcher"))
+                    return
+            logger.debug(str(e))
 
     logger.info("Perform init() on Fofb-Watcher. This takes nearly a minute.")
     try:
         wprx.init()
     except tango.DevFailed as e:
         logger.error("Could not perform init() on Fofb-Watcher.")
+        logger.debug(str(e))
 
     logger.info("Perform init() on Fofb-Command.")
-    tango.DeviceProxy(tangopath["fofb-command"]).init()
+    try:
+        tango.DeviceProxy(tangopath["fofb-command"]).init()
+    except tango.DevFailed as e:
+        logger.error("Could not perform init() on '{}', got DevFailed.".format(tangopath['fofb-command']))
+        logger.debug(str(e))
 
 def confds_opcua():
     """
-- 
GitLab