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.cpp b/sensorhandler.cpp
index d67e7f5..b321e96 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include "sensorhandler.hpp"
 
 #include "fruread.hpp"
@@ -420,6 +422,12 @@
         resp->operation = 1 << scanningEnabledBit;
         return IPMI_CC_OK;
     }
+#ifdef UPDATE_FUNCTIONAL_ON_FAIL
+    catch (const SensorFunctionalError& e)
+    {
+        return IPMI_CC_RESPONSE_ERROR;
+    }
+#endif
     catch (const std::exception& e)
     {
         *data_len = getResponse.size();