core_manager: Handle dbus exceptions

The code was using deprecated is_method_error() to check errors, but the
sdbusplus now throws on DBus errors.
When there is no space for new dump (by default 1M), it will get an
exception and crashes like below:

    phosphor-dump-monitor[166]: terminate called after throwing an instance of 'sdbusplus::exception::SdBusError'
    phosphor-dump-monitor[166]:   what():  sd_bus_call noreply: xyz.openbmc_project.Dump.Create.Error.QuotaExceeded: Dump not captured due to a cap.

Add try-catch to handle the exceptions.

Tested: Verify when there is no space for new dump there is no more
        dump-monitor crash and it just prints an error:

    phosphor-dump-monitor[174]: Failed to create dump

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ibd290587fd16c59be98ccff52887f598ee5b5c33
diff --git a/core_manager.cpp b/core_manager.cpp
index 753a26b..a62c89c 100644
--- a/core_manager.cpp
+++ b/core_manager.cpp
@@ -64,24 +64,17 @@
                                     MAPPER_INTERFACE, "GetObject");
     mapper.append(OBJ_INTERNAL, vector<string>({IFACE_INTERNAL}));
 
-    auto mapperResponseMsg = b.call(mapper);
-    if (mapperResponseMsg.is_method_error())
-    {
-        log<level::ERR>("Error in mapper call");
-        return;
-    }
-
     map<string, vector<string>> mapperResponse;
     try
     {
+        auto mapperResponseMsg = b.call(mapper);
         mapperResponseMsg.read(mapperResponse);
     }
     catch (const sdbusplus::exception::SdBusError& e)
     {
-        log<level::ERR>(fmt::format("Failed to parse dump create message, "
-                                    "errormsg({}), REPLY_SIG({})",
-                                    e.what(), mapperResponseMsg.get_signature())
-                            .c_str());
+        log<level::ERR>(
+            fmt::format("Failed to GetObject on Dump.Internal: {}", e.what())
+                .c_str());
         return;
     }
     if (mapperResponse.empty())
@@ -94,7 +87,15 @@
     auto m =
         b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL, "Create");
     m.append(APPLICATION_CORED, files);
-    b.call_noreply(m);
+    try
+    {
+        b.call_noreply(m);
+    }
+    catch (const sdbusplus::exception::SdBusError& e)
+    {
+        log<level::ERR>(
+            fmt::format("Failed to create dump: {}", e.what()).c_str());
+    }
 }
 
 } // namespace core