pfr-manager: Suppress i2c exception messages in readCPLDReg

Add support to suppress exception messages occurred during i2c operation
when non-pfr CPLD is present.

Tested:

Verified that exceptions were masked.

Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
Change-Id: Id8f910e0da2eee18f00253883fcefe845f3fca69
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index 1058197..a01b845 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -81,6 +81,8 @@
     "SGPIO_PLD_MINOR_REV_BIT3", "SGPIO_PLD_MINOR_REV_BIT2",
     "SGPIO_PLD_MINOR_REV_BIT1", "SGPIO_PLD_MINOR_REV_BIT0"};
 
+bool exceptionFlag = true;
+
 std::string toHexString(const uint8_t val)
 {
     std::stringstream stream;
@@ -431,9 +433,13 @@
     }
     catch (const std::exception& e)
     {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "Exception caught in readCpldReg.",
-            phosphor::logging::entry("MSG=%s", e.what()));
+        if (exceptionFlag)
+        {
+            exceptionFlag = false;
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "Exception caught in readCpldReg.",
+                phosphor::logging::entry("MSG=%s", e.what()));
+        }
         return -1;
     }
 }