diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 09b700f..e17f146 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -34,8 +34,11 @@
     bool wasValid = wd_service.isValid(bus);
     auto request = wd_service.newMethodCall(bus, wd_intf, "ResetTimeRemaining");
     request.append(enableWatchdog);
-    auto response = bus.call(request);
-    if (response.is_method_error())
+    try
+    {
+        auto response = bus.call(request);
+    }
+    catch (const std::exception& e)
     {
         wd_service.invalidate();
         if (wasValid)
@@ -45,7 +48,8 @@
         }
         log<level::ERR>(
             "WatchdogService: Method error resetting time remaining",
-            entry("ENABLE_WATCHDOG=%d", !!enableWatchdog));
+            entry("ENABLE_WATCHDOG=%d", !!enableWatchdog),
+            entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
@@ -55,8 +59,14 @@
     bool wasValid = wd_service.isValid(bus);
     auto request = wd_service.newMethodCall(bus, prop_intf, "GetAll");
     request.append(wd_intf);
-    auto response = bus.call(request);
-    if (response.is_method_error())
+
+    std::map<std::string, std::variant<bool, uint64_t, std::string>> properties;
+    try
+    {
+        auto response = bus.call(request);
+        response.read(properties);
+    }
+    catch (const std::exception& e)
     {
         wd_service.invalidate();
         if (wasValid)
@@ -64,14 +74,13 @@
             // Retry the request once in case the cached service was stale
             return getProperties();
         }
-        log<level::ERR>("WatchdogService: Method error getting properties");
+        log<level::ERR>("WatchdogService: Method error getting properties",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
+
     try
     {
-        std::map<std::string, std::variant<bool, uint64_t, std::string>>
-            properties;
-        response.read(properties);
         Properties wd_prop;
         wd_prop.initialized = std::get<bool>(properties.at("Initialized"));
         wd_prop.enabled = std::get<bool>(properties.at("Enabled"));
@@ -90,8 +99,7 @@
     catch (const std::exception& e)
     {
         log<level::ERR>("WatchdogService: Decode error in get properties",
-                        entry("ERROR=%s", e.what()),
-                        entry("REPLY_SIG=%s", response.get_signature()));
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
@@ -107,8 +115,14 @@
     bool wasValid = wd_service.isValid(bus);
     auto request = wd_service.newMethodCall(bus, prop_intf, "Get");
     request.append(wd_intf, key);
-    auto response = bus.call(request);
-    if (response.is_method_error())
+    try
+    {
+        auto response = bus.call(request);
+        std::variant<T> value;
+        response.read(value);
+        return std::get<T>(value);
+    }
+    catch (const std::exception& e)
     {
         wd_service.invalidate();
         if (wasValid)
@@ -117,21 +131,8 @@
             return getProperty<T>(key);
         }
         log<level::ERR>("WatchdogService: Method error getting property",
-                        entry("PROPERTY=%s", key.c_str()));
-        elog<InternalFailure>();
-    }
-    try
-    {
-        std::variant<T> value;
-        response.read(value);
-        return std::get<T>(value);
-    }
-    catch (const std::exception& e)
-    {
-        log<level::ERR>("WatchdogService: Decode error in get property",
                         entry("PROPERTY=%s", key.c_str()),
-                        entry("ERROR=%s", e.what()),
-                        entry("REPLY_SIG=%s", response.get_signature()));
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
@@ -147,8 +148,11 @@
     bool wasValid = wd_service.isValid(bus);
     auto request = wd_service.newMethodCall(bus, prop_intf, "Set");
     request.append(wd_intf, key, std::variant<T>(val));
-    auto response = bus.call(request);
-    if (response.is_method_error())
+    try
+    {
+        auto response = bus.call(request);
+    }
+    catch (const std::exception& e)
     {
         wd_service.invalidate();
         if (wasValid)
@@ -158,7 +162,8 @@
             return;
         }
         log<level::ERR>("WatchdogService: Method error setting property",
-                        entry("PROPERTY=%s", key.c_str()));
+                        entry("PROPERTY=%s", key.c_str()),
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
diff --git a/chassishandler.cpp b/chassishandler.cpp
index be0c4c1..89d3e00 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1407,32 +1407,17 @@
 std::string getEnclosureIdentifyConnection()
 {
     // lookup enclosure_identify group owner(s) in mapper
-    auto mapperCall = chassis::internal::dbus.new_method_call(
-        ipmi::MAPPER_BUS_NAME, ipmi::MAPPER_OBJ, ipmi::MAPPER_INTF,
-        "GetObject");
-
-    mapperCall.append(identify_led_object_name);
-    static const std::vector<std::string> interfaces = {
-        "xyz.openbmc_project.Led.Group"};
-    mapperCall.append(interfaces);
-    auto mapperReply = chassis::internal::dbus.call(mapperCall);
-    if (mapperReply.is_method_error())
+    try
     {
-        log<level::ERR>("Chassis Identify: Error communicating to mapper.");
+        return ipmi::getService(*getSdBus(), "xyz.openbmc_project.Led.Group",
+                                identify_led_object_name);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Chassis Identify: Error communicating to mapper.",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
-    std::vector<std::pair<std::string, std::vector<std::string>>> mapperResp;
-    mapperReply.read(mapperResp);
-
-    if (mapperResp.size() != encIdentifyObjectsSize)
-    {
-        log<level::ERR>(
-            "Invalid number of enclosure identify objects.",
-            entry("ENC_IDENTITY_OBJECTS_SIZE=%d", mapperResp.size()));
-        elog<InternalFailure>();
-    }
-    auto pair = mapperResp[encIdentifyObjectsSize - 1];
-    return pair.first;
 }
 
 /** @brief Turn On/Off enclosure identify LED
@@ -1443,20 +1428,23 @@
 void enclosureIdentifyLed(bool flag)
 {
     using namespace chassis::internal;
-    std::string connection = getEnclosureIdentifyConnection();
-    auto msg = std::string("enclosureIdentifyLed(") +
-               boost::lexical_cast<std::string>(flag) + ")";
-    log<level::DEBUG>(msg.c_str());
-    auto led = dbus.new_method_call(connection.c_str(),
-                                    identify_led_object_name,
-                                    "org.freedesktop.DBus.Properties", "Set");
-    led.append("xyz.openbmc_project.Led.Group", "Asserted",
-               std::variant<bool>(flag));
-    auto ledReply = dbus.call(led);
-    if (ledReply.is_method_error())
+    try
+    {
+        std::string connection = getEnclosureIdentifyConnection();
+
+        auto msg = std::string("enclosureIdentifyLed(") +
+                   boost::lexical_cast<std::string>(flag) + ")";
+        log<level::DEBUG>(msg.c_str());
+
+        ipmi::setDbusProperty(*getSdBus(), connection, identify_led_object_name,
+                              "xyz.openbmc_project.Led.Group", "Asserted",
+                              flag);
+    }
+    catch (const std::exception& e)
     {
         log<level::ERR>("Chassis Identify: Error Setting State On/Off\n",
-                        entry("LED_STATE=%d", flag));
+                        entry("LED_STATE=%d", flag),
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index d34ab31..ca2ee7d 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -81,17 +81,19 @@
                                       "org.freedesktop.DBus.Properties", "Get");
 
     method.append(PCAP_INTERFACE, POWER_CAP_PROP);
-    auto reply = bus.call(method);
 
-    if (reply.is_method_error())
+    std::variant<uint32_t> pcap;
+    try
     {
-        log<level::ERR>("Error in getPcap prop");
+        auto reply = bus.call(method);
+        reply.read(pcap);
+        return std::get<uint32_t>(pcap);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in getPcap prop", entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
-    std::variant<uint32_t> pcap;
-    reply.read(pcap);
-
-    return std::get<uint32_t>(pcap);
 }
 
 bool getPcapEnabled(sdbusplus::bus_t& bus)
@@ -102,17 +104,20 @@
                                       "org.freedesktop.DBus.Properties", "Get");
 
     method.append(PCAP_INTERFACE, POWER_CAP_ENABLE_PROP);
-    auto reply = bus.call(method);
 
-    if (reply.is_method_error())
+    std::variant<bool> pcapEnabled;
+    try
     {
-        log<level::ERR>("Error in getPcapEnabled prop");
+        auto reply = bus.call(method);
+        reply.read(pcapEnabled);
+        return std::get<bool>(pcapEnabled);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in getPcapEnabled prop",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
-    std::variant<bool> pcapEnabled;
-    reply.read(pcapEnabled);
-
-    return std::get<bool>(pcapEnabled);
 }
 
 void setPcap(sdbusplus::bus_t& bus, const uint32_t powerCap)
@@ -125,11 +130,14 @@
     method.append(PCAP_INTERFACE, POWER_CAP_PROP);
     method.append(std::variant<uint32_t>(powerCap));
 
-    auto reply = bus.call(method);
-
-    if (reply.is_method_error())
+    try
     {
-        log<level::ERR>("Error in setPcap property");
+        auto reply = bus.call(method);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in setPcap property",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
@@ -144,11 +152,14 @@
     method.append(PCAP_INTERFACE, POWER_CAP_ENABLE_PROP);
     method.append(std::variant<bool>(enabled));
 
-    auto reply = bus.call(method);
-
-    if (reply.is_method_error())
+    try
     {
-        log<level::ERR>("Error in setPcapEnabled property");
+        auto reply = bus.call(method);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in setPcapEnabled property",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
@@ -170,18 +181,20 @@
     mapperCall.append(depth);
     mapperCall.append(std::vector<std::string>({dcmi::assetTagIntf}));
 
-    auto mapperReply = bus.call(mapperCall);
-    if (mapperReply.is_method_error())
+    try
     {
-        log<level::ERR>("Error in mapper call");
-        elog<InternalFailure>();
+        auto mapperReply = bus.call(mapperCall);
+        mapperReply.read(objectTree);
+
+        if (objectTree.empty())
+        {
+            log<level::ERR>("AssetTag property is not populated");
+            elog<InternalFailure>();
+        }
     }
-
-    mapperReply.read(objectTree);
-
-    if (objectTree.empty())
+    catch (const std::exception& e)
     {
-        log<level::ERR>("AssetTag property is not populated");
+        log<level::ERR>("Error in mapper call", entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
@@ -201,17 +214,19 @@
     method.append(dcmi::assetTagIntf);
     method.append(dcmi::assetTagProp);
 
-    auto reply = bus.call(method);
-    if (reply.is_method_error())
+    std::variant<std::string> assetTag;
+    try
     {
-        log<level::ERR>("Error in reading asset tag");
+        auto reply = bus.call(method);
+        reply.read(assetTag);
+        return std::get<std::string>(assetTag);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in reading asset tag",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
-
-    std::variant<std::string> assetTag;
-    reply.read(assetTag);
-
-    return std::get<std::string>(assetTag);
 }
 
 void writeAssetTag(const std::string& assetTag)
@@ -230,10 +245,14 @@
     method.append(dcmi::assetTagProp);
     method.append(std::variant<std::string>(assetTag));
 
-    auto reply = bus.call(method);
-    if (reply.is_method_error())
+    try
     {
-        log<level::ERR>("Error in writing asset tag");
+        auto reply = bus.call(method);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in writing asset tag",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 }
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
diff --git a/selutility.cpp b/selutility.cpp
index 3473814..9684b36 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -190,16 +190,19 @@
                                           propIntf, "GetAll");
     methodCall.append(logEntryIntf);
 
-    auto reply = bus.call(methodCall);
-    if (reply.is_method_error())
+    entryDataMap entryData;
+    try
     {
-        log<level::ERR>("Error in reading logging property entries");
+        auto reply = bus.call(methodCall);
+        reply.read(entryData);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in reading logging property entries",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
-    entryDataMap entryData;
-    reply.read(entryData);
-
     // Read Id from the log entry.
     static constexpr auto propId = "Id";
     auto iterId = entryData.find(propId);
@@ -322,18 +325,21 @@
     methodCall.append(assocIntf);
     methodCall.append(assocProp);
 
-    auto reply = bus.call(methodCall);
-    if (reply.is_method_error())
-    {
-        log<level::ERR>("Error in reading Associations interface");
-        elog<InternalFailure>();
-    }
-
     using AssociationList =
         std::vector<std::tuple<std::string, std::string, std::string>>;
 
     std::variant<AssociationList> list;
-    reply.read(list);
+    try
+    {
+        auto reply = bus.call(methodCall);
+        reply.read(list);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in reading Associations interface",
+                        entry("ERROR=%s", e.what()));
+        elog<InternalFailure>();
+    }
 
     auto& assocs = std::get<AssociationList>(list);
 
@@ -381,16 +387,19 @@
     methodCall.append(logEntryIntf);
     methodCall.append(propTimeStamp);
 
-    auto reply = bus.call(methodCall);
-    if (reply.is_method_error())
+    std::variant<uint64_t> timeStamp;
+    try
     {
-        log<level::ERR>("Error in reading Timestamp from Entry interface");
+        auto reply = bus.call(methodCall);
+        reply.read(timeStamp);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in reading Timestamp from Entry interface",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
-    std::variant<uint64_t> timeStamp;
-    reply.read(timeStamp);
-
     std::chrono::milliseconds chronoTimeStamp(std::get<uint64_t>(timeStamp));
 
     return std::chrono::duration_cast<std::chrono::seconds>(chronoTimeStamp);
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index e29cfac..93ee714 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -41,22 +41,18 @@
     mapperCall.append(depth);
     mapperCall.append(std::vector<Interface>({interface}));
 
-    auto mapperResponseMsg = bus.call(mapperCall);
-    if (mapperResponseMsg.is_method_error())
-    {
-        log<level::ERR>("Mapper GetSubTree failed",
-                        entry("PATH=%s", path.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
-        elog<InternalFailure>();
-    }
-
     MapperResponseType mapperResponse;
-    mapperResponseMsg.read(mapperResponse);
-    if (mapperResponse.empty())
+    try
+    {
+        auto mapperResponseMsg = bus.call(mapperCall);
+        mapperResponseMsg.read(mapperResponse);
+    }
+    catch (const std::exception& e)
     {
         log<level::ERR>("Invalid mapper response",
                         entry("PATH=%s", path.c_str()),
-                        entry("INTERFACE=%s", interface.c_str()));
+                        entry("INTERFACE=%s", interface.c_str()),
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
@@ -94,14 +90,10 @@
     try
     {
         auto serviceResponseMsg = bus.call(msg);
-        if (serviceResponseMsg.is_method_error())
-        {
-            log<level::ERR>("Error in D-Bus call");
-            return IPMI_CC_UNSPECIFIED_ERROR;
-        }
     }
     catch (const InternalFailure& e)
     {
+        log<level::ERR>("Error in D-Bus call", entry("ERROR=%s", e.what()));
         commit<InternalFailure>();
         return IPMI_CC_UNSPECIFIED_ERROR;
     }
diff --git a/settings.cpp b/settings.cpp
index 862aa63..25c420e 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -26,20 +26,19 @@
     mapperCall.append(root);
     mapperCall.append(depth);
     mapperCall.append(filter);
-    auto response = bus.call(mapperCall);
-    if (response.is_method_error())
-    {
-        log<level::ERR>("Error in mapper GetSubTree");
-        elog<InternalFailure>();
-    }
 
     using Interfaces = std::vector<Interface>;
     using MapperResponse = std::map<Path, std::map<Service, Interfaces>>;
     MapperResponse result;
-    response.read(result);
-    if (result.empty())
+    try
     {
-        log<level::ERR>("Invalid response from mapper");
+        auto response = bus.call(mapperCall);
+        response.read(result);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in mapper GetSubTree",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
@@ -70,22 +69,19 @@
     mapperCall.append(path);
     mapperCall.append(Interfaces({interface}));
 
-    auto response = bus.call(mapperCall);
-    if (response.is_method_error())
-    {
-        log<level::ERR>("Error in mapper GetObject");
-        elog<InternalFailure>();
-    }
-
     std::map<Service, Interfaces> result;
-    response.read(result);
-    if (result.empty())
+    try
     {
-        log<level::ERR>("Invalid response from mapper");
+        auto response = bus.call(mapperCall);
+        response.read(result);
+        return result.begin()->first;
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Invalid response from mapper",
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
-
-    return result.begin()->first;
 }
 
 namespace boot
@@ -119,17 +115,22 @@
         objects.service(oneTimeSetting, iface).c_str(), oneTimeSetting.c_str(),
         ipmi::PROP_INTF, "Get");
     method.append(enabledIntf, "Enabled");
-    auto reply = objects.bus.call(method);
-    if (reply.is_method_error())
+
+    std::variant<bool> enabled;
+    try
+    {
+        auto reply = objects.bus.call(method);
+        reply.read(enabled);
+    }
+    catch (const std::exception& e)
     {
         log<level::ERR>("Error in getting Enabled property",
                         entry("OBJECT=%s", oneTimeSetting.c_str()),
-                        entry("INTERFACE=%s", iface.c_str()));
+                        entry("INTERFACE=%s", iface.c_str()),
+                        entry("ERROR=%s", e.what()));
         elog<InternalFailure>();
     }
 
-    std::variant<bool> enabled;
-    reply.read(enabled);
     auto oneTimeEnabled = std::get<bool>(enabled);
     const Path& setting = oneTimeEnabled ? oneTimeSetting : regularSetting;
     return std::make_tuple(setting, oneTimeEnabled);
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 0c2c9bd..7dcde4c 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -41,16 +41,17 @@
                                       CONTROL_HOST_BUSNAME, "Execute");
 
     method.append(convertForMessage(Host::Command::SoftOff).c_str());
-
-    auto reply = bus.call(method);
-    if (reply.is_method_error())
+    try
     {
-        log<level::ERR>("Error in call to control host Execute");
+        auto reply = bus.call(method);
+    }
+    catch (const std::exception& e)
+    {
+        log<level::ERR>("Error in call to control host Execute",
+                        entry("ERROR=%s", e.what()));
         // TODO openbmc/openbmc#851 - Once available, throw returned error
         throw std::runtime_error("Error in call to control host Execute");
     }
-
-    return;
 }
 
 // Function called on host control signals
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 0ac735b..0a7ac1c 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -466,8 +466,11 @@
 
     auto methodCall = bus.new_method_call(service.c_str(), objPath.c_str(),
                                           ipmi::sel::logDeleteIntf, "Delete");
-    auto reply = bus.call(methodCall);
-    if (reply.is_method_error())
+    try
+    {
+        auto reply = bus.call(methodCall);
+    }
+    catch (const std::exception& e)
     {
         return ipmi::responseUnspecifiedError();
     }
@@ -556,13 +559,6 @@
 
         method.append(TIME_INTERFACE, PROPERTY_ELAPSED);
         auto reply = bus.call(method);
-        if (reply.is_method_error())
-        {
-            log<level::ERR>("Error getting time",
-                            entry("SERVICE=%s", service.c_str()),
-                            entry("PATH=%s", BMC_TIME_PATH));
-            return ipmi::responseUnspecifiedError();
-        }
         reply.read(value);
         bmc_time_usec = std::get<uint64_t>(value);
     }
@@ -618,13 +614,6 @@
 
         method.append(TIME_INTERFACE, PROPERTY_ELAPSED, value);
         auto reply = bus.call(method);
-        if (reply.is_method_error())
-        {
-            log<level::ERR>("Error setting time",
-                            entry("SERVICE=%s", service.c_str()),
-                            entry("PATH=%s", BMC_TIME_PATH));
-            return ipmi::responseUnspecifiedError();
-        }
     }
     catch (const InternalFailure& e)
     {
