sensordatahandler: Throw on sensor's OperationalStatus

Add UPDATE_FUNCTIONAL_ON_FAIL and only when defined, read sensor's
OperationalStatus interface for the functional property and throw if the
sensor is not funcitonal.

Bug: openbmc/phosphor-hwmon#10
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I1144a6d3f8145bda73f3363664ca48b848a295db
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index 56a7021..f5a8b41 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -2,6 +2,7 @@
 
 #include <stdint.h>
 
+#include <exception>
 #include <ipmid/api.hpp>
 #include <ipmid/types.hpp>
 
@@ -38,6 +39,16 @@
     IPMI_SENSOR_TPM = 0xCC,
 };
 
+/** @brief Custom exception for reading sensors that are not funcitonal.
+ */
+struct SensorFunctionalError : public std::exception
+{
+    const char* what() const noexcept
+    {
+        return "Sensor not functional";
+    }
+};
+
 #define MAX_DBUS_PATH 128
 struct dbus_interface_t
 {