From 0049c98b6e4ee5fa5e78054a5a666b1e29598ab7 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Wed, 6 Jun 2018 15:33:22 -0500 Subject: Add sdbusplus exception handling Tested: Verified that the phosphor-dbus-monitor does not core dump with the latest sdbusplus changes to support sdbusplus exceptions. Instead it logs the "Failed to parse method response" error msg in the journal. Resolves openbmc/openbmc#3213 Change-Id: I11347725364b5a43df6c0c1c377d65ce361a419c Signed-off-by: Adriana Kobylak --- src/sdbusplus.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/sdbusplus.hpp') diff --git a/src/sdbusplus.hpp b/src/sdbusplus.hpp index 1b54582..4339bad 100644 --- a/src/sdbusplus.hpp +++ b/src/sdbusplus.hpp @@ -1,6 +1,8 @@ #pragma once +#include #include +#include #include #include #include "data_types.hpp" @@ -14,6 +16,9 @@ namespace dbus namespace monitoring { +using namespace phosphor::logging; +using sdbusplus::exception::SdBusError; + /** @class SDBusPlus * @brief DBus access delegate implementation for sdbusplus. */ @@ -72,7 +77,16 @@ class SDBusPlus Ret resp; sdbusplus::message::message respMsg = callMethod( busName, path, interface, method, std::forward(args)...); - respMsg.read(resp); + try + { + respMsg.read(resp); + } + catch (const SdBusError& e) + { + log("Failed to parse method response", + entry("ERROR=%s", e.what()), + entry("REPLY_SIG=%s", respMsg.get_signature())); + } return resp; } -- cgit v1.2.1