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/host-bmc/dbus_to_host_effecters.cpp b/host-bmc/dbus_to_host_effecters.cpp
index a90a3bd..89a8a95 100644
--- a/host-bmc/dbus_to_host_effecters.cpp
+++ b/host-bmc/dbus_to_host_effecters.cpp
@@ -16,7 +16,6 @@
{
namespace host_effecters
{
-
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
@@ -178,7 +177,8 @@
catch (const sdbusplus::exception_t& e)
{
std::cerr << "Error in getting current host state. Will still "
- "continue to set the host effecter \n";
+ "continue to set the host effecter - "
+ << e.what() << std::endl;
}
uint8_t newState{};
try
diff --git a/libpldmresponder/bios_enum_attribute.cpp b/libpldmresponder/bios_enum_attribute.cpp
index 6dd87fc..e878827 100644
--- a/libpldmresponder/bios_enum_attribute.cpp
+++ b/libpldmresponder/bios_enum_attribute.cpp
@@ -14,7 +14,6 @@
{
namespace bios
{
-
BIOSEnumAttribute::BIOSEnumAttribute(const Json& entry,
DBusHandler* const dbusHandler) :
BIOSAttribute(entry, dbusHandler)
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 "