diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2018-12-10 13:45:09 -0600 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2018-12-11 08:21:31 -0600 |
commit | 3b6a4cd700a60a1e4c969900e87a5e58512ebc89 (patch) | |
tree | 88de0b03d0c65250bda59ac8277a000dc39872d8 /ubi | |
parent | 02516d3ff949271de661666353aa87ee06d74cce (diff) | |
download | phosphor-bmc-code-mgmt-3b6a4cd700a60a1e4c969900e87a5e58512ebc89.tar.gz phosphor-bmc-code-mgmt-3b6a4cd700a60a1e4c969900e87a5e58512ebc89.zip |
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>
Diffstat (limited to 'ubi')
-rw-r--r-- | ubi/item_updater_helper.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
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 @@ namespace updater { using namespace phosphor::logging; +using sdbusplus::exception::SdBusError; void Helper::setEntry(const std::string& entryId, uint8_t value) { @@ -69,10 +71,12 @@ void Helper::updateUbootVersionId(const std::string& versionId) 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 @@ void Helper::mirrorAlt() 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"); } |