usb-dbg: 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: I8f4f1f3b257e7a0e8d54eb96273504455d611857
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index 57c3339..f02469e 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -556,20 +556,23 @@
"org.openbmc.Ipmb", "sendRequest");
method.append(bicAddr, netFn, lun, cmd, cmdData);
- auto reply = bus->call(method);
- if (reply.is_method_error())
+ try
+ {
+ auto reply = bus->call(method);
+
+ IpmbMethodType resp;
+ reply.read(resp);
+
+ respData = std::move(
+ std::get<std::remove_reference_t<decltype(respData)>>(resp));
+ }
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error reading from BIC");
return -1;
}
- IpmbMethodType resp;
- reply.read(resp);
-
- respData =
- std::move(std::get<std::remove_reference_t<decltype(respData)>>(resp));
-
return 0;
}
@@ -594,20 +597,23 @@
"org.openbmc.Ipmb", "sendRequest");
method.append(meAddress, netFn, lun, cmd, cmdData);
- auto reply = bus->call(method);
- if (reply.is_method_error())
+ try
+ {
+ auto reply = bus->call(method);
+
+ IpmbMethodType resp;
+ reply.read(resp);
+
+ respData = std::move(
+ std::get<std::remove_reference_t<decltype(respData)>>(resp));
+ }
+ catch (const sdbusplus::exception_t& e)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
"Error reading from ME");
return -1;
}
- IpmbMethodType resp;
- reply.read(resp);
-
- respData =
- std::move(std::get<std::remove_reference_t<decltype(respData)>>(resp));
-
if (DEBUG)
{
std::cout << "ME resp data: ";