From baeb53822ce50cd07e6249e90aa6514a07f94cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Bron=C3=A8s?= <romain.brones@synchrotron-soleil.fr> Date: Thu, 16 May 2024 16:28:36 +0200 Subject: [PATCH] Increase exception handling on init * Catch DevFail on GetAttNameAll * Be more verbose --- ArchiveExtractor/Access.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ArchiveExtractor/Access.py b/ArchiveExtractor/Access.py index e27e5c5..6d465b8 100644 --- a/ArchiveExtractor/Access.py +++ b/ArchiveExtractor/Access.py @@ -52,6 +52,7 @@ def init( logger.setLevel(getattr(logging, loglevel.upper())) except AttributeError: logger.error("Wrong log level specified: {}".format(loglevel.upper())) + logger.error("Init module failed. You can try to run ArchiveExtractor.init() again with another configuration") return logger.debug("Instanciating extractors device proxy...") @@ -61,6 +62,7 @@ def init( _Extr.append(tango.DeviceProxy(p)) except tango.DevFailed: logger.error("Could not find extractor {}".format(p)) + logger.error("Init module failed. You can try to run ArchiveExtractor.init() again with another configuration") return logger.debug("{} and {} instanciated.".format(*_Extr)) @@ -70,12 +72,13 @@ def init( # set timeout to 3 sec e.set_timeout_millis(3000) - logger.debug("Filling attributes lookup tables...") + logger.debug("Filling attributes lookup tables (use GetAttNameAll)...") for e in _Extr: try: _Attr.append(e.getattnameall()) - except AttributeError: + except (tango.DevFailed, AttributeError): logger.error("Could not fetch attributes for extractor {}".format(e)) + logger.error("Init module failed. You can try to run ArchiveExtractor.init() again with another configuration") return logger.debug("HDB: {} TDB: {} attributes counted".format(len(_Attr[0]), len(_Attr[1]))) -- GitLab