Remove is_method_error method
Remove the usage of is_method_error()[1], and add try-catch to handle
D-Bus exceptions around mapper call.
[1]https://github.com/openbmc/sdbusplus/commit/079fb85a398d90800935e3985bb1266a7530a26e#diff-945669e8bd9cab4ecc83a574a732921281b2c79eb8bba65efff11736ad18f92bR237-R240
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I85192219c1c34cf5fd6c6aca06a8b207d7e06697
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index 09b700f..e17f146 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -34,8 +34,11 @@
bool wasValid = wd_service.isValid(bus);
auto request = wd_service.newMethodCall(bus, wd_intf, "ResetTimeRemaining");
request.append(enableWatchdog);
- auto response = bus.call(request);
- if (response.is_method_error())
+ try
+ {
+ auto response = bus.call(request);
+ }
+ catch (const std::exception& e)
{
wd_service.invalidate();
if (wasValid)
@@ -45,7 +48,8 @@
}
log<level::ERR>(
"WatchdogService: Method error resetting time remaining",
- entry("ENABLE_WATCHDOG=%d", !!enableWatchdog));
+ entry("ENABLE_WATCHDOG=%d", !!enableWatchdog),
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
@@ -55,8 +59,14 @@
bool wasValid = wd_service.isValid(bus);
auto request = wd_service.newMethodCall(bus, prop_intf, "GetAll");
request.append(wd_intf);
- auto response = bus.call(request);
- if (response.is_method_error())
+
+ std::map<std::string, std::variant<bool, uint64_t, std::string>> properties;
+ try
+ {
+ auto response = bus.call(request);
+ response.read(properties);
+ }
+ catch (const std::exception& e)
{
wd_service.invalidate();
if (wasValid)
@@ -64,14 +74,13 @@
// Retry the request once in case the cached service was stale
return getProperties();
}
- log<level::ERR>("WatchdogService: Method error getting properties");
+ log<level::ERR>("WatchdogService: Method error getting properties",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
+
try
{
- std::map<std::string, std::variant<bool, uint64_t, std::string>>
- properties;
- response.read(properties);
Properties wd_prop;
wd_prop.initialized = std::get<bool>(properties.at("Initialized"));
wd_prop.enabled = std::get<bool>(properties.at("Enabled"));
@@ -90,8 +99,7 @@
catch (const std::exception& e)
{
log<level::ERR>("WatchdogService: Decode error in get properties",
- entry("ERROR=%s", e.what()),
- entry("REPLY_SIG=%s", response.get_signature()));
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
@@ -107,8 +115,14 @@
bool wasValid = wd_service.isValid(bus);
auto request = wd_service.newMethodCall(bus, prop_intf, "Get");
request.append(wd_intf, key);
- auto response = bus.call(request);
- if (response.is_method_error())
+ try
+ {
+ auto response = bus.call(request);
+ std::variant<T> value;
+ response.read(value);
+ return std::get<T>(value);
+ }
+ catch (const std::exception& e)
{
wd_service.invalidate();
if (wasValid)
@@ -117,21 +131,8 @@
return getProperty<T>(key);
}
log<level::ERR>("WatchdogService: Method error getting property",
- entry("PROPERTY=%s", key.c_str()));
- elog<InternalFailure>();
- }
- try
- {
- std::variant<T> value;
- response.read(value);
- return std::get<T>(value);
- }
- catch (const std::exception& e)
- {
- log<level::ERR>("WatchdogService: Decode error in get property",
entry("PROPERTY=%s", key.c_str()),
- entry("ERROR=%s", e.what()),
- entry("REPLY_SIG=%s", response.get_signature()));
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
@@ -147,8 +148,11 @@
bool wasValid = wd_service.isValid(bus);
auto request = wd_service.newMethodCall(bus, prop_intf, "Set");
request.append(wd_intf, key, std::variant<T>(val));
- auto response = bus.call(request);
- if (response.is_method_error())
+ try
+ {
+ auto response = bus.call(request);
+ }
+ catch (const std::exception& e)
{
wd_service.invalidate();
if (wasValid)
@@ -158,7 +162,8 @@
return;
}
log<level::ERR>("WatchdogService: Method error setting property",
- entry("PROPERTY=%s", key.c_str()));
+ entry("PROPERTY=%s", key.c_str()),
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
diff --git a/chassishandler.cpp b/chassishandler.cpp
index be0c4c1..89d3e00 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1407,32 +1407,17 @@
std::string getEnclosureIdentifyConnection()
{
// lookup enclosure_identify group owner(s) in mapper
- auto mapperCall = chassis::internal::dbus.new_method_call(
- ipmi::MAPPER_BUS_NAME, ipmi::MAPPER_OBJ, ipmi::MAPPER_INTF,
- "GetObject");
-
- mapperCall.append(identify_led_object_name);
- static const std::vector<std::string> interfaces = {
- "xyz.openbmc_project.Led.Group"};
- mapperCall.append(interfaces);
- auto mapperReply = chassis::internal::dbus.call(mapperCall);
- if (mapperReply.is_method_error())
+ try
{
- log<level::ERR>("Chassis Identify: Error communicating to mapper.");
+ return ipmi::getService(*getSdBus(), "xyz.openbmc_project.Led.Group",
+ identify_led_object_name);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Chassis Identify: Error communicating to mapper.",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
- std::vector<std::pair<std::string, std::vector<std::string>>> mapperResp;
- mapperReply.read(mapperResp);
-
- if (mapperResp.size() != encIdentifyObjectsSize)
- {
- log<level::ERR>(
- "Invalid number of enclosure identify objects.",
- entry("ENC_IDENTITY_OBJECTS_SIZE=%d", mapperResp.size()));
- elog<InternalFailure>();
- }
- auto pair = mapperResp[encIdentifyObjectsSize - 1];
- return pair.first;
}
/** @brief Turn On/Off enclosure identify LED
@@ -1443,20 +1428,23 @@
void enclosureIdentifyLed(bool flag)
{
using namespace chassis::internal;
- std::string connection = getEnclosureIdentifyConnection();
- auto msg = std::string("enclosureIdentifyLed(") +
- boost::lexical_cast<std::string>(flag) + ")";
- log<level::DEBUG>(msg.c_str());
- auto led = dbus.new_method_call(connection.c_str(),
- identify_led_object_name,
- "org.freedesktop.DBus.Properties", "Set");
- led.append("xyz.openbmc_project.Led.Group", "Asserted",
- std::variant<bool>(flag));
- auto ledReply = dbus.call(led);
- if (ledReply.is_method_error())
+ try
+ {
+ std::string connection = getEnclosureIdentifyConnection();
+
+ auto msg = std::string("enclosureIdentifyLed(") +
+ boost::lexical_cast<std::string>(flag) + ")";
+ log<level::DEBUG>(msg.c_str());
+
+ ipmi::setDbusProperty(*getSdBus(), connection, identify_led_object_name,
+ "xyz.openbmc_project.Led.Group", "Asserted",
+ flag);
+ }
+ catch (const std::exception& e)
{
log<level::ERR>("Chassis Identify: Error Setting State On/Off\n",
- entry("LED_STATE=%d", flag));
+ entry("LED_STATE=%d", flag),
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index d34ab31..ca2ee7d 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -81,17 +81,19 @@
"org.freedesktop.DBus.Properties", "Get");
method.append(PCAP_INTERFACE, POWER_CAP_PROP);
- auto reply = bus.call(method);
- if (reply.is_method_error())
+ std::variant<uint32_t> pcap;
+ try
{
- log<level::ERR>("Error in getPcap prop");
+ auto reply = bus.call(method);
+ reply.read(pcap);
+ return std::get<uint32_t>(pcap);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in getPcap prop", entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
- std::variant<uint32_t> pcap;
- reply.read(pcap);
-
- return std::get<uint32_t>(pcap);
}
bool getPcapEnabled(sdbusplus::bus_t& bus)
@@ -102,17 +104,20 @@
"org.freedesktop.DBus.Properties", "Get");
method.append(PCAP_INTERFACE, POWER_CAP_ENABLE_PROP);
- auto reply = bus.call(method);
- if (reply.is_method_error())
+ std::variant<bool> pcapEnabled;
+ try
{
- log<level::ERR>("Error in getPcapEnabled prop");
+ auto reply = bus.call(method);
+ reply.read(pcapEnabled);
+ return std::get<bool>(pcapEnabled);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in getPcapEnabled prop",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
- std::variant<bool> pcapEnabled;
- reply.read(pcapEnabled);
-
- return std::get<bool>(pcapEnabled);
}
void setPcap(sdbusplus::bus_t& bus, const uint32_t powerCap)
@@ -125,11 +130,14 @@
method.append(PCAP_INTERFACE, POWER_CAP_PROP);
method.append(std::variant<uint32_t>(powerCap));
- auto reply = bus.call(method);
-
- if (reply.is_method_error())
+ try
{
- log<level::ERR>("Error in setPcap property");
+ auto reply = bus.call(method);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in setPcap property",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
@@ -144,11 +152,14 @@
method.append(PCAP_INTERFACE, POWER_CAP_ENABLE_PROP);
method.append(std::variant<bool>(enabled));
- auto reply = bus.call(method);
-
- if (reply.is_method_error())
+ try
{
- log<level::ERR>("Error in setPcapEnabled property");
+ auto reply = bus.call(method);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in setPcapEnabled property",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
@@ -170,18 +181,20 @@
mapperCall.append(depth);
mapperCall.append(std::vector<std::string>({dcmi::assetTagIntf}));
- auto mapperReply = bus.call(mapperCall);
- if (mapperReply.is_method_error())
+ try
{
- log<level::ERR>("Error in mapper call");
- elog<InternalFailure>();
+ auto mapperReply = bus.call(mapperCall);
+ mapperReply.read(objectTree);
+
+ if (objectTree.empty())
+ {
+ log<level::ERR>("AssetTag property is not populated");
+ elog<InternalFailure>();
+ }
}
-
- mapperReply.read(objectTree);
-
- if (objectTree.empty())
+ catch (const std::exception& e)
{
- log<level::ERR>("AssetTag property is not populated");
+ log<level::ERR>("Error in mapper call", entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
@@ -201,17 +214,19 @@
method.append(dcmi::assetTagIntf);
method.append(dcmi::assetTagProp);
- auto reply = bus.call(method);
- if (reply.is_method_error())
+ std::variant<std::string> assetTag;
+ try
{
- log<level::ERR>("Error in reading asset tag");
+ auto reply = bus.call(method);
+ reply.read(assetTag);
+ return std::get<std::string>(assetTag);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in reading asset tag",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
-
- std::variant<std::string> assetTag;
- reply.read(assetTag);
-
- return std::get<std::string>(assetTag);
}
void writeAssetTag(const std::string& assetTag)
@@ -230,10 +245,14 @@
method.append(dcmi::assetTagProp);
method.append(std::variant<std::string>(assetTag));
- auto reply = bus.call(method);
- if (reply.is_method_error())
+ try
{
- log<level::ERR>("Error in writing asset tag");
+ auto reply = bus.call(method);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in writing asset tag",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
}
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 302c0b7..1261c2e 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -55,11 +55,6 @@
mapperCall.append(serviceRoot, depth, interfaces);
auto mapperReply = bus.call(mapperCall);
- if (mapperReply.is_method_error())
- {
- log<level::ERR>("Error in mapper call");
- elog<InternalFailure>();
- }
ObjectTree objectTree;
mapperReply.read(objectTree);
@@ -112,16 +107,6 @@
method.append(interface, property);
auto reply = bus.call(method, timeout.count());
-
- if (reply.is_method_error())
- {
- log<level::ERR>("Failed to get property",
- entry("PROPERTY=%s", property.c_str()),
- entry("PATH=%s", objPath.c_str()),
- entry("INTERFACE=%s", interface.c_str()));
- elog<InternalFailure>();
- }
-
reply.read(value);
return value;
@@ -141,16 +126,8 @@
method.append(interface);
auto reply = bus.call(method, timeout.count());
-
- if (reply.is_method_error())
- {
- log<level::ERR>("Failed to get all properties",
- entry("PATH=%s", objPath.c_str()),
- entry("INTERFACE=%s", interface.c_str()));
- elog<InternalFailure>();
- }
-
reply.read(properties);
+
return properties;
}
@@ -163,17 +140,9 @@
auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
"org.freedesktop.DBus.ObjectManager",
"GetManagedObjects");
-
auto reply = bus.call(method);
-
- if (reply.is_method_error())
- {
- log<level::ERR>("Failed to get managed objects",
- entry("PATH=%s", objPath.c_str()));
- elog<InternalFailure>();
- }
-
reply.read(interfaces);
+
return interfaces;
}
@@ -249,11 +218,6 @@
auto mapperResponseMsg = bus.call(mapperCall);
- if (mapperResponseMsg.is_method_error())
- {
- throw std::runtime_error("ERROR in mapper call");
- }
-
std::map<std::string, std::vector<std::string>> mapperResponse;
mapperResponseMsg.read(mapperResponse);
@@ -281,15 +245,6 @@
mapperCall.append(serviceRoot, depth, interfaces);
auto mapperReply = bus.call(mapperCall);
- if (mapperReply.is_method_error())
- {
- log<level::ERR>("Error in mapper call",
- entry("SERVICEROOT=%s", serviceRoot.c_str()),
- entry("INTERFACE=%s", interface.c_str()));
-
- elog<InternalFailure>();
- }
-
ObjectTree objectTree;
mapperReply.read(objectTree);
@@ -350,15 +305,6 @@
mapperCall.append(path, interfaces);
auto mapperReply = bus.call(mapperCall);
- if (mapperReply.is_method_error())
- {
- log<level::ERR>(
- "Error in mapper call", entry("PATH=%s", path.c_str()),
- entry("INTERFACES=%s", convertToString(interfaces).c_str()));
-
- elog<InternalFailure>();
- }
-
ObjectTree objectTree;
mapperReply.read(objectTree);
@@ -384,17 +330,7 @@
{
auto busMethod = bus.new_method_call(service.c_str(), objPath.c_str(),
interface.c_str(), method.c_str());
-
auto reply = bus.call(busMethod);
-
- if (reply.is_method_error())
- {
- log<level::ERR>("Failed to execute method",
- entry("METHOD=%s", method.c_str()),
- entry("PATH=%s", objPath.c_str()),
- entry("INTERFACE=%s", interface.c_str()));
- elog<InternalFailure>();
- }
}
} // namespace method_no_args
diff --git a/selutility.cpp b/selutility.cpp
index 3473814..9684b36 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -190,16 +190,19 @@
propIntf, "GetAll");
methodCall.append(logEntryIntf);
- auto reply = bus.call(methodCall);
- if (reply.is_method_error())
+ entryDataMap entryData;
+ try
{
- log<level::ERR>("Error in reading logging property entries");
+ auto reply = bus.call(methodCall);
+ reply.read(entryData);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in reading logging property entries",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
- entryDataMap entryData;
- reply.read(entryData);
-
// Read Id from the log entry.
static constexpr auto propId = "Id";
auto iterId = entryData.find(propId);
@@ -322,18 +325,21 @@
methodCall.append(assocIntf);
methodCall.append(assocProp);
- auto reply = bus.call(methodCall);
- if (reply.is_method_error())
- {
- log<level::ERR>("Error in reading Associations interface");
- elog<InternalFailure>();
- }
-
using AssociationList =
std::vector<std::tuple<std::string, std::string, std::string>>;
std::variant<AssociationList> list;
- reply.read(list);
+ try
+ {
+ auto reply = bus.call(methodCall);
+ reply.read(list);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in reading Associations interface",
+ entry("ERROR=%s", e.what()));
+ elog<InternalFailure>();
+ }
auto& assocs = std::get<AssociationList>(list);
@@ -381,16 +387,19 @@
methodCall.append(logEntryIntf);
methodCall.append(propTimeStamp);
- auto reply = bus.call(methodCall);
- if (reply.is_method_error())
+ std::variant<uint64_t> timeStamp;
+ try
{
- log<level::ERR>("Error in reading Timestamp from Entry interface");
+ auto reply = bus.call(methodCall);
+ reply.read(timeStamp);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in reading Timestamp from Entry interface",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
- std::variant<uint64_t> timeStamp;
- reply.read(timeStamp);
-
std::chrono::milliseconds chronoTimeStamp(std::get<uint64_t>(timeStamp));
return std::chrono::duration_cast<std::chrono::seconds>(chronoTimeStamp);
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index e29cfac..93ee714 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -41,22 +41,18 @@
mapperCall.append(depth);
mapperCall.append(std::vector<Interface>({interface}));
- auto mapperResponseMsg = bus.call(mapperCall);
- if (mapperResponseMsg.is_method_error())
- {
- log<level::ERR>("Mapper GetSubTree failed",
- entry("PATH=%s", path.c_str()),
- entry("INTERFACE=%s", interface.c_str()));
- elog<InternalFailure>();
- }
-
MapperResponseType mapperResponse;
- mapperResponseMsg.read(mapperResponse);
- if (mapperResponse.empty())
+ try
+ {
+ auto mapperResponseMsg = bus.call(mapperCall);
+ mapperResponseMsg.read(mapperResponse);
+ }
+ catch (const std::exception& e)
{
log<level::ERR>("Invalid mapper response",
entry("PATH=%s", path.c_str()),
- entry("INTERFACE=%s", interface.c_str()));
+ entry("INTERFACE=%s", interface.c_str()),
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
@@ -94,14 +90,10 @@
try
{
auto serviceResponseMsg = bus.call(msg);
- if (serviceResponseMsg.is_method_error())
- {
- log<level::ERR>("Error in D-Bus call");
- return IPMI_CC_UNSPECIFIED_ERROR;
- }
}
catch (const InternalFailure& e)
{
+ log<level::ERR>("Error in D-Bus call", entry("ERROR=%s", e.what()));
commit<InternalFailure>();
return IPMI_CC_UNSPECIFIED_ERROR;
}
diff --git a/settings.cpp b/settings.cpp
index 862aa63..25c420e 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -26,20 +26,19 @@
mapperCall.append(root);
mapperCall.append(depth);
mapperCall.append(filter);
- auto response = bus.call(mapperCall);
- if (response.is_method_error())
- {
- log<level::ERR>("Error in mapper GetSubTree");
- elog<InternalFailure>();
- }
using Interfaces = std::vector<Interface>;
using MapperResponse = std::map<Path, std::map<Service, Interfaces>>;
MapperResponse result;
- response.read(result);
- if (result.empty())
+ try
{
- log<level::ERR>("Invalid response from mapper");
+ auto response = bus.call(mapperCall);
+ response.read(result);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in mapper GetSubTree",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
@@ -70,22 +69,19 @@
mapperCall.append(path);
mapperCall.append(Interfaces({interface}));
- auto response = bus.call(mapperCall);
- if (response.is_method_error())
- {
- log<level::ERR>("Error in mapper GetObject");
- elog<InternalFailure>();
- }
-
std::map<Service, Interfaces> result;
- response.read(result);
- if (result.empty())
+ try
{
- log<level::ERR>("Invalid response from mapper");
+ auto response = bus.call(mapperCall);
+ response.read(result);
+ return result.begin()->first;
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Invalid response from mapper",
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
-
- return result.begin()->first;
}
namespace boot
@@ -119,17 +115,22 @@
objects.service(oneTimeSetting, iface).c_str(), oneTimeSetting.c_str(),
ipmi::PROP_INTF, "Get");
method.append(enabledIntf, "Enabled");
- auto reply = objects.bus.call(method);
- if (reply.is_method_error())
+
+ std::variant<bool> enabled;
+ try
+ {
+ auto reply = objects.bus.call(method);
+ reply.read(enabled);
+ }
+ catch (const std::exception& e)
{
log<level::ERR>("Error in getting Enabled property",
entry("OBJECT=%s", oneTimeSetting.c_str()),
- entry("INTERFACE=%s", iface.c_str()));
+ entry("INTERFACE=%s", iface.c_str()),
+ entry("ERROR=%s", e.what()));
elog<InternalFailure>();
}
- std::variant<bool> enabled;
- reply.read(enabled);
auto oneTimeEnabled = std::get<bool>(enabled);
const Path& setting = oneTimeEnabled ? oneTimeSetting : regularSetting;
return std::make_tuple(setting, oneTimeEnabled);
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 0c2c9bd..7dcde4c 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -41,16 +41,17 @@
CONTROL_HOST_BUSNAME, "Execute");
method.append(convertForMessage(Host::Command::SoftOff).c_str());
-
- auto reply = bus.call(method);
- if (reply.is_method_error())
+ try
{
- log<level::ERR>("Error in call to control host Execute");
+ auto reply = bus.call(method);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>("Error in call to control host Execute",
+ entry("ERROR=%s", e.what()));
// TODO openbmc/openbmc#851 - Once available, throw returned error
throw std::runtime_error("Error in call to control host Execute");
}
-
- return;
}
// Function called on host control signals
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 0ac735b..0a7ac1c 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -466,8 +466,11 @@
auto methodCall = bus.new_method_call(service.c_str(), objPath.c_str(),
ipmi::sel::logDeleteIntf, "Delete");
- auto reply = bus.call(methodCall);
- if (reply.is_method_error())
+ try
+ {
+ auto reply = bus.call(methodCall);
+ }
+ catch (const std::exception& e)
{
return ipmi::responseUnspecifiedError();
}
@@ -556,13 +559,6 @@
method.append(TIME_INTERFACE, PROPERTY_ELAPSED);
auto reply = bus.call(method);
- if (reply.is_method_error())
- {
- log<level::ERR>("Error getting time",
- entry("SERVICE=%s", service.c_str()),
- entry("PATH=%s", BMC_TIME_PATH));
- return ipmi::responseUnspecifiedError();
- }
reply.read(value);
bmc_time_usec = std::get<uint64_t>(value);
}
@@ -618,13 +614,6 @@
method.append(TIME_INTERFACE, PROPERTY_ELAPSED, value);
auto reply = bus.call(method);
- if (reply.is_method_error())
- {
- log<level::ERR>("Error setting time",
- entry("SERVICE=%s", service.c_str()),
- entry("PATH=%s", BMC_TIME_PATH));
- return ipmi::responseUnspecifiedError();
- }
}
catch (const InternalFailure& e)
{