phosphor-fan-presence elog error exception.
Implemented elog exception for phosphor fan presence,
replacing runtime_errors.
Change-Id: I70465060838b2cbaeadccf84ed5924e222ac59e3
Signed-off-by: Dinesh Chinari <chinari@us.ibm.com>
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 80eb974..2ece054 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
#include "fan.hpp"
#include "tach_sensor.hpp"
#include "../utility.hpp"
@@ -25,6 +28,10 @@
namespace monitor
{
+using namespace phosphor::logging;
+using InternalFailure = sdbusplus::xyz::openbmc_project::Common::
+ Error::InternalFailure;
+
constexpr auto PROPERTY_INTF = "org.freedesktop.DBus.Properties";
constexpr auto FAN_SENSOR_PATH = "/xyz/openbmc_project/sensors/fan_tach/";
constexpr auto FAN_SENSOR_CONTROL_INTF = "xyz.openbmc_project.Control.FanSpeed";
@@ -65,9 +72,9 @@
auto reply = bus.call(method);
if (reply.is_method_error())
{
- throw std::runtime_error(
- "Error in property get call for path " +
- path);
+ log<level::ERR>("Error in property get call",
+ entry("PATH=%s", path.c_str()));
+ elog<InternalFailure>();
}
reply.read(property);