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>();
     }
 }
