From ccb0929d41c61f8dd8e86c0b5ab5427d82a6fb56 Mon Sep 17 00:00:00 2001
From: MALFREYT <alexandre.malfreyt@synchrotron-soleil.fr>
Date: Wed, 23 Apr 2025 14:59:47 +0200
Subject: [PATCH] fix: improve error logging for get_device_property in
 init_device (logs and status)

---
 src/SingleShotAO.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp
index 198af76..d02281c 100755
--- a/src/SingleShotAO.cpp
+++ b/src/SingleShotAO.cpp
@@ -267,8 +267,15 @@ void SingleShotAO::init_device()
 		ERROR_STREAM << "SingleShotAO::init_device::Tango::DevFailed exception caught "
 			<< "while trying to read device properties from TANGO database"
 			<< std::endl;
-		ERROR_STREAM << df << std::endl;
-		m_currStatus = "Failed to get property. See log for details";
+		std::string error_msg = df.errors[0].desc;
+		std::istringstream error_stream(error_msg);
+		std::string line;
+		std::getline(error_stream, line); // Read the first line
+		ERROR_STREAM << line << std::endl;
+		while (std::getline(error_stream, line)) { // Read the rest of the lines
+			ERROR_STREAM << " - " << line << std::endl;
+		}
+		m_currStatus = error_msg;
 		m_state = Tango::FAULT;
 		return;
 	}
-- 
GitLab