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>
diff --git a/item_updater.cpp b/item_updater.cpp
index 22734ef..e2d0f94 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -464,22 +464,25 @@
std::vector<std::string> filter = {BMC_INVENTORY_INTERFACE};
mapperCall.append(filter);
- auto response = bus.call(mapperCall);
- if (response.is_method_error())
+ try
+ {
+ auto response = bus.call(mapperCall);
+
+ using ObjectPaths = std::vector<std::string>;
+ ObjectPaths result;
+ response.read(result);
+
+ if (!result.empty())
+ {
+ bmcInventoryPath = result.front();
+ }
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
{
log<level::ERR>("Error in mapper GetSubTreePath");
return;
}
- using ObjectPaths = std::vector<std::string>;
- ObjectPaths result;
- response.read(result);
-
- if (!result.empty())
- {
- bmcInventoryPath = result.front();
- }
-
return;
}