From 80c1b2848205b482af374fdf797f797b5bf1eef6 Mon Sep 17 00:00:00 2001
From: stedif <stefano.difrischia@inaf.it>
Date: Mon, 27 Jun 2022 11:15:36 +0200
Subject: [PATCH] L2SS-819: prevent exception raising if tango device is not
 responding

---
 .../devices/sdp/statistics_collector.py        | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tangostationcontrol/tangostationcontrol/devices/sdp/statistics_collector.py b/tangostationcontrol/tangostationcontrol/devices/sdp/statistics_collector.py
index eada78887..b611d6614 100644
--- a/tangostationcontrol/tangostationcontrol/devices/sdp/statistics_collector.py
+++ b/tangostationcontrol/tangostationcontrol/devices/sdp/statistics_collector.py
@@ -110,10 +110,7 @@ class SSTCollector(StatisticsCollector):
         self.parameters["subbands_calibrated"][input_index]   = fields.subband_calibrated_flag
 
         # add tango values to packet
-        try:
-            self.parse_device_attributes(device)
-        except Exception as e:
-            raise Exception from e 
+        self.parse_device_attributes(device)
     
     def parse_device_attributes(self, device: DeviceProxy):
 
@@ -128,14 +125,11 @@ class SSTCollector(StatisticsCollector):
                 self.parameters["rcu_attenuator_dB"] = device.RCU_Attenuator_dB_R
                 self.parameters["rcu_band_select"] = device.RCU_Band_Select_R
                 self.parameters["rcu_dth_on"] = device.RCU_DTH_on_R
-            except DevFailed as  e: 
-                if e.args[0].reason in ['Attribute not found', 'API_AttrNotAllowed', 'API_AttrNotFound']:
-                    logger.warning(f"Device {device.name()} not responding.")
-                    self.parameters["rcu_attenuator_dB"] = None
-                    self.parameters["rcu_band_select"] = None
-                    self.parameters["rcu_dth_on"] = None
-                else:
-                    raise Exception from e     
+            except DevFailed as e: 
+                logger.warning(f"Device {device.name()} not responding.")
+                self.parameters["rcu_attenuator_dB"] = None
+                self.parameters["rcu_band_select"] = None
+                self.parameters["rcu_dth_on"] = None   
 
 class XSTCollector(StatisticsCollector):
     """ Class to process XST statistics packets.
-- 
GitLab