Remove is_method_error method

Remove the usage of is_method_error()[1], and add try-catch to handle
D-Bus exceptions around mapper call.

[1]https://github.com/openbmc/sdbusplus/commit/079fb85a398d90800935e3985bb1266a7530a26e#diff-945669e8bd9cab4ecc83a574a732921281b2c79eb8bba65efff11736ad18f92bR237-R240

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I85192219c1c34cf5fd6c6aca06a8b207d7e06697
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 302c0b7..1261c2e 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -55,11 +55,6 @@
     mapperCall.append(serviceRoot, depth, interfaces);
 
     auto mapperReply = bus.call(mapperCall);
-    if (mapperReply.is_method_error())
-    {
-        log<level::ERR>("Error in mapper call");
-        elog<InternalFailure>();
-    }
 
     ObjectTree objectTree;
     mapperReply.read(objectTree);
@@ -112,16 +107,6 @@
     method.append(interface, property);
 
     auto reply = bus.call(method, timeout.count());
-
-    if (reply.is_method_error())
-    {
-        log<level::ERR>("Failed to get property",
-                        entry("PROPERTY=%s", property.c_str()),
-                        entry("PATH=%s", objPath.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
-        elog<InternalFailure>();
-    }
-
     reply.read(value);
 
     return value;
@@ -141,16 +126,8 @@
     method.append(interface);
 
     auto reply = bus.call(method, timeout.count());
-
-    if (reply.is_method_error())
-    {
-        log<level::ERR>("Failed to get all properties",
-                        entry("PATH=%s", objPath.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
-        elog<InternalFailure>();
-    }
-
     reply.read(properties);
+
     return properties;
 }
 
@@ -163,17 +140,9 @@
     auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
                                       "org.freedesktop.DBus.ObjectManager",
                                       "GetManagedObjects");
-
     auto reply = bus.call(method);
-
-    if (reply.is_method_error())
-    {
-        log<level::ERR>("Failed to get managed objects",
-                        entry("PATH=%s", objPath.c_str()));
-        elog<InternalFailure>();
-    }
-
     reply.read(interfaces);
+
     return interfaces;
 }
 
@@ -249,11 +218,6 @@
 
     auto mapperResponseMsg = bus.call(mapperCall);
 
-    if (mapperResponseMsg.is_method_error())
-    {
-        throw std::runtime_error("ERROR in mapper call");
-    }
-
     std::map<std::string, std::vector<std::string>> mapperResponse;
     mapperResponseMsg.read(mapperResponse);
 
@@ -281,15 +245,6 @@
     mapperCall.append(serviceRoot, depth, interfaces);
 
     auto mapperReply = bus.call(mapperCall);
-    if (mapperReply.is_method_error())
-    {
-        log<level::ERR>("Error in mapper call",
-                        entry("SERVICEROOT=%s", serviceRoot.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
-
-        elog<InternalFailure>();
-    }
-
     ObjectTree objectTree;
     mapperReply.read(objectTree);
 
@@ -350,15 +305,6 @@
     mapperCall.append(path, interfaces);
 
     auto mapperReply = bus.call(mapperCall);
-    if (mapperReply.is_method_error())
-    {
-        log<level::ERR>(
-            "Error in mapper call", entry("PATH=%s", path.c_str()),
-            entry("INTERFACES=%s", convertToString(interfaces).c_str()));
-
-        elog<InternalFailure>();
-    }
-
     ObjectTree objectTree;
     mapperReply.read(objectTree);
 
@@ -384,17 +330,7 @@
 {
     auto busMethod = bus.new_method_call(service.c_str(), objPath.c_str(),
                                          interface.c_str(), method.c_str());
-
     auto reply = bus.call(busMethod);
-
-    if (reply.is_method_error())
-    {
-        log<level::ERR>("Failed to execute method",
-                        entry("METHOD=%s", method.c_str()),
-                        entry("PATH=%s", objPath.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
-        elog<InternalFailure>();
-    }
 }
 
 } // namespace method_no_args