Handle D-Bus exceptions

Remove the usage of is_method_error()[1].

Also, add try-catch to handle D-Bus exceptions around mapper call.

[1]https://github.com/openbmc/sdbusplus/blob/master/include/sdbusplus/bus.hpp#L282-L286

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Id2b5234009e62e6c003f24a25c726317646b582b
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index 885c020..047994f 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -54,26 +54,18 @@
     auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
                                       MAPPER_IFACE, "GetObject");
     mapper.append(path.c_str(), std::vector<std::string>({OBJMGR_IFACE}));
-    auto mapperResponseMsg = bus.call(mapper);
-    if (mapperResponseMsg.is_method_error())
-    {
-        using namespace xyz::openbmc_project::Led::Mapper;
-        elog<MethodErr>(MethodError::METHOD_NAME("GetObject"),
-                        MethodError::PATH(path.c_str()),
-                        MethodError::INTERFACE(OBJMGR_IFACE));
-    }
 
     std::map<std::string, std::vector<std::string>> mapperResponse;
     try
     {
+        auto mapperResponseMsg = bus.call(mapper);
         mapperResponseMsg.read(mapperResponse);
     }
     catch (const sdbusplus::exception::exception& e)
     {
         log<level::ERR>(
-            "Failed to parse getService mapper response",
-            entry("ERROR=%s", e.what()),
-            entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
+            "Failed to GetObject or parse getService mapper response",
+            entry("ERROR=%s", e.what()));
         using namespace xyz::openbmc_project::Led::Mapper;
         elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
                                 ObjectNotFoundError::PATH(path.c_str()),
@@ -215,30 +207,12 @@
     try
     {
         auto mapperResponseMsg = bus.call(mapperCall);
-        if (mapperResponseMsg.is_method_error())
-        {
-            using namespace xyz::openbmc_project::Led::Mapper;
-            report<MethodErr>(MethodError::METHOD_NAME("GetSubTree"),
-                              MethodError::PATH(MAPPER_OBJ_PATH),
-                              MethodError::INTERFACE(OBJMGR_IFACE));
-            return;
-        }
-
-        try
-        {
-            mapperResponseMsg.read(subtree);
-        }
-        catch (const sdbusplus::exception::exception& e)
-        {
-            log<level::ERR>(
-                "Failed to parse existing callouts subtree message",
-                entry("ERROR=%s", e.what()),
-                entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
-        }
+        mapperResponseMsg.read(subtree);
     }
     catch (const sdbusplus::exception::exception& e)
     {
-        // Just means no log entries at the moment
+        log<level::ERR>("Failed to parse existing callouts subtree message",
+                        entry("ERROR=%s", e.what()));
     }
 }
 
@@ -275,10 +249,9 @@
         }
         catch (const sdbusplus::exception::exception& e)
         {
-            log<level::ERR>(
-                "Failed to parse existing callouts associations message",
-                entry("ERROR=%s", e.what()),
-                entry("REPLY_SIG=%s", reply.get_signature()));
+            log<level::ERR>("Failed to get Associations or  parse existing "
+                            "callouts associations message",
+                            entry("ERROR=%s", e.what()));
             continue;
         }
         auto& assocs = std::get<AssociationList>(assoc);
diff --git a/utils.cpp b/utils.cpp
index 41b78b9..7a565a4 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -26,14 +26,6 @@
     mapper.append(path, InterfaceList({interface}));
 
     auto mapperResponseMsg = bus.call(mapper);
-    if (mapperResponseMsg.is_method_error())
-    {
-        log<level::ERR>("Failed to invoke ObjectMapper method",
-                        entry("OBJECT_PATH=%s", path.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
-        return "";
-    }
-
     mapperResponseMsg.read(mapperResponse);
     if (mapperResponse.empty())
     {