remove is_method_error call
An `is_method_error` is not appropriate after an sdbus `call` since
`call` will always throw an exception. Remove the pointless call
and instead catch the exception.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib82c90e78508b5e996ced1d29091dd609f1fba07
diff --git a/user_mgr.cpp b/user_mgr.cpp
index 0029326..efaeb5b 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -1101,17 +1101,18 @@
mapperCall.append(std::move(path));
mapperCall.append(std::vector<std::string>({std::move(intf)}));
- auto mapperResponseMsg = bus.call(mapperCall);
-
- if (mapperResponseMsg.is_method_error())
+ std::map<std::string, std::vector<std::string>> mapperResponse;
+ try
{
- lg2::error("Error in mapper call");
+ auto mapperResponseMsg = bus.call(mapperCall);
+ mapperResponseMsg.read(mapperResponse);
+ }
+ catch (const sdbusplus::exception_t& e)
+ {
+ lg2::error("Error in mapper call: {ERROR}", "ERROR", e.what());
elog<InternalFailure>();
}
- std::map<std::string, std::vector<std::string>> mapperResponse;
- mapperResponseMsg.read(mapperResponse);
-
if (mapperResponse.begin() == mapperResponse.end())
{
lg2::error("Invalid response from mapper");