diff options
author | Ed Tanous <ed.tanous@intel.com> | 2018-08-10 12:51:53 -0700 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2018-08-10 13:02:35 -0700 |
commit | 87c781732247086a56d8f8cb4360c6eb4863f658 (patch) | |
tree | e072930398af2b44a12259c5ee807e9996617502 | |
parent | dd691576c829350dd9718909be6a36de70a42e27 (diff) | |
download | phosphor-bmc-code-mgmt-87c781732247086a56d8f8cb4360c6eb4863f658.tar.gz phosphor-bmc-code-mgmt-87c781732247086a56d8f8cb4360c6eb4863f658.zip |
Catch SdBusError when calling the mapper
In certain cases, the mapper may return a not found error when polling
for BMC endpoints. While this is an error, it should not crash
phosphor-software-manager.
Tested By: Booted the system without a bmc interface present, and
verified that software manager doesn't crash
Change-Id: I1199d6f94deb6cf5a795f8770d9dac202697f401
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
-rw-r--r-- | item_updater.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/item_updater.cpp b/item_updater.cpp index 22734ef..e2d0f94 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -464,20 +464,23 @@ void ItemUpdater::setBMCInventoryPath() std::vector<std::string> filter = {BMC_INVENTORY_INTERFACE}; mapperCall.append(filter); - auto response = bus.call(mapperCall); - if (response.is_method_error()) + try { - log<level::ERR>("Error in mapper GetSubTreePath"); - return; - } + auto response = bus.call(mapperCall); - using ObjectPaths = std::vector<std::string>; - ObjectPaths result; - response.read(result); + using ObjectPaths = std::vector<std::string>; + ObjectPaths result; + response.read(result); - if (!result.empty()) + if (!result.empty()) + { + bmcInventoryPath = result.front(); + } + } + catch (const sdbusplus::exception::SdBusError& e) { - bmcInventoryPath = result.front(); + log<level::ERR>("Error in mapper GetSubTreePath"); + return; } return; |