Remove deprecated is_method_error code
The is_method_error() function is no longer needed, instead a
try-catch block should be used instead.
Reference:
https://lists.ozlabs.org/pipermail/openbmc/2018-October/013696.html,
Change-Id: I1919ea33fc18be2b8afd51fb1f85ddef15041e7c
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/ubi/item_updater_helper.cpp b/ubi/item_updater_helper.cpp
index 68162cb..a699d5f 100644
--- a/ubi/item_updater_helper.cpp
+++ b/ubi/item_updater_helper.cpp
@@ -3,6 +3,7 @@
#include "item_updater_helper.hpp"
#include <phosphor-logging/log.hpp>
+#include <sdbusplus/exception.hpp>
namespace phosphor
{
@@ -12,6 +13,7 @@
{
using namespace phosphor::logging;
+using sdbusplus::exception::SdBusError;
void Helper::setEntry(const std::string& entryId, uint8_t value)
{
@@ -69,10 +71,12 @@
auto updateEnvVarsFile =
"obmc-flash-bmc-updateubootvars@" + versionId + ".service";
method.append(updateEnvVarsFile, "replace");
- auto result = bus.call(method);
- // Check that the bus call didn't result in an error
- if (result.is_method_error())
+ try
+ {
+ bus.call_noreply(method);
+ }
+ catch (const SdBusError& e)
{
log<level::ERR>("Failed to update u-boot env variables",
entry("VERSIONID=%s", versionId.c_str()));
@@ -105,10 +109,12 @@
SYSTEMD_INTERFACE, "StartUnit");
auto mirrorUbootFile = "obmc-flash-bmc-mirroruboot.service";
method.append(mirrorUbootFile, "replace");
- auto result = bus.call(method);
- // Check that the bus call didn't result in an error
- if (result.is_method_error())
+ try
+ {
+ bus.call_noreply(method);
+ }
+ catch (const SdBusError& e)
{
log<level::ERR>("Failed to copy U-Boot to alternate chip");
}