Handle Dbus query exception gracefully
For every Dbus query PLDM uses new_method_call defined in
Sdbusplus. Any error during dbus query it throws an exception.
Modifying code to handle the exception thrown by new_method_call
Change-Id: Ie474e1d230773cb184127b71d333846090ad6c84
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 708dd87..13fe9f0 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -52,10 +52,6 @@
std::string curResDumpEntryPath{};
dbus::ObjectValueTree objects;
- auto method =
- bus.new_method_call(DUMP_MANAGER_BUSNAME, DUMP_MANAGER_PATH,
- OBJECT_MANAGER_INTERFACE, "GetManagedObjects");
-
// Select the dump entry interface for system dump or resource dump
DumpEntryInterface dumpEntryIntf = systemDumpEntry;
if ((dumpType == PLDM_FILE_TYPE_RESOURCE_DUMP) ||
@@ -66,11 +62,14 @@
try
{
+ auto method =
+ bus.new_method_call(DUMP_MANAGER_BUSNAME, DUMP_MANAGER_PATH,
+ OBJECT_MANAGER_INTERFACE, "GetManagedObjects");
+
auto reply = bus.call(method);
reply.read(objects);
}
-
- catch (const std::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
std::cerr << "findDumpObjPath: Error " << e.what()
<< "found with GetManagedObjects call in findDumpObjPath "