softoff: switch to 'report' error API
phosphor-logging now has an interface to avoid needing a
try/catch to report an error in the same location it is
discovered, so switch to using it.
Change-Id: I96b6f3ec10b39f6ce3030b95f94768c00c3ad9d8
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/softoff/mainapp.cpp b/softoff/mainapp.cpp
index 1f037fc..0bfb067 100644
--- a/softoff/mainapp.cpp
+++ b/softoff/mainapp.cpp
@@ -74,18 +74,10 @@
if(powerObj.isTimerExpired() && (powerObj.responseReceived() ==
phosphor::ipmi::Base::SoftPowerOff::HostResponse::SoftOffReceived))
{
- try
- {
- elog<sdbusplus::xyz::openbmc_project::State
- ::Host::Error::SoftOffTimeout>(
- prev_entry<phosphor::logging::xyz::openbmc_project::State
- ::Host::SoftOffTimeout::TIMEOUT_IN_MSEC>());
- }
- catch (sdbusplus::xyz::openbmc_project::State::Host::Error
- ::SoftOffTimeout& elog)
- {
- commit(elog.name());
- }
+ using error =
+ sdbusplus::xyz::openbmc_project::State::Host::Error::SoftOffTimeout;
+ using errorMetadata = xyz::openbmc_project::State::Host::SoftOffTimeout;
+ report<error>(prev_entry<errorMetadata::TIMEOUT_IN_MSEC>());
}
// Cleanup the event handler