fix crash due to uncaught exception

i2creadByteData can throw exception, catch it to prevent
pfr-manager crash on system with no cpld.

Tested:
Build and run the new code, pfr-manager stays up on
system that it crashed without the change.

Command:
GET: https://<BMC_IP>/redfish/v1/UpdateService/FirmwareInventory/
     cpld_recovery
Response:
{
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/cpld_recovery",
    "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
    "Description": "Other image",
    "Id": "cpld_recovery",
    "Name": "Software Inventory",
    "Status": {
        "Health": "Warning",
        "HealthRollup": "OK",
        "State": "StandbySpare"
    },
    "Updateable": true,
    "Version": ""
}

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: Id8b80f56eebaa225010fa6b835a75a31a507a3b7
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index c95a694..7a8b136 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -295,8 +295,17 @@
 
     // check if reg 0x00 read 0xde
     uint8_t cpldRoTValue = 0;
-    I2CFile cpldDev(i2cBusNumber, i2cSlaveAddress, O_RDWR | O_CLOEXEC);
-    cpldRoTValue = cpldDev.i2cReadByteData(pfrROTId);
+    try
+    {
+        I2CFile cpldDev(i2cBusNumber, i2cSlaveAddress, O_RDWR | O_CLOEXEC);
+        cpldRoTValue = cpldDev.i2cReadByteData(pfrROTId);
+    }
+    catch (const std::exception& e)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Exception caught in readCPLDVersion.",
+            phosphor::logging::entry("MSG=%s", e.what()));
+    }
 
     if (cpldRoTValue == pfrRoTValue)
     {