From 87c781732247086a56d8f8cb4360c6eb4863f658 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Fri, 10 Aug 2018 12:51:53 -0700 Subject: 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 --- item_updater.cpp | 23 +++++++++++++---------- 1 file 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 filter = {BMC_INVENTORY_INTERFACE}; mapperCall.append(filter); - auto response = bus.call(mapperCall); - if (response.is_method_error()) + try { - log("Error in mapper GetSubTreePath"); - return; - } + auto response = bus.call(mapperCall); - using ObjectPaths = std::vector; - ObjectPaths result; - response.read(result); + using ObjectPaths = std::vector; + ObjectPaths result; + response.read(result); - if (!result.empty()) + if (!result.empty()) + { + bmcInventoryPath = result.front(); + } + } + catch (const sdbusplus::exception::SdBusError& e) { - bmcInventoryPath = result.front(); + log("Error in mapper GetSubTreePath"); + return; } return; -- cgit v1.2.1