Set error code for isFruPowerOffOnly API

This commit updates isFruPowerOffOnly API to set error code in case of
error. This helps caller of API to take action based on the error code
returned from the API.

Change-Id: Ieb5b0a649ed802cc08ad836bc7399d3dacec9429
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/vpd-manager/include/utility/json_utility.hpp b/vpd-manager/include/utility/json_utility.hpp
index 8a8aa18..358fda1 100644
--- a/vpd-manager/include/utility/json_utility.hpp
+++ b/vpd-manager/include/utility/json_utility.hpp
@@ -969,28 +969,29 @@
  *
  * @param[in] i_sysCfgJsonObj - System config JSON object.
  * @param[in] i_vpdFruPath - EEPROM path.
+ * @param[out] o_errCode - To set error code for the error.
  * @return - True if FRU VPD can be collected at Chassis Power Off state only.
  *           False otherwise
  */
 inline bool isFruPowerOffOnly(const nlohmann::json& i_sysCfgJsonObj,
-                              const std::string& i_vpdFruPath)
+                              const std::string& i_vpdFruPath,
+                              uint16_t& o_errCode)
 {
     if (i_vpdFruPath.empty())
     {
-        logging::logMessage("FRU path is empty.");
+        o_errCode = error_code::INVALID_INPUT_PARAMETER;
         return false;
     }
 
     if (!i_sysCfgJsonObj.contains("frus"))
     {
-        logging::logMessage("Missing frus tag in system config JSON.");
+        o_errCode = error_code::INVALID_JSON;
         return false;
     }
 
     if (!i_sysCfgJsonObj["frus"].contains(i_vpdFruPath))
     {
-        logging::logMessage("JSON object does not contain EEPROM path \'" +
-                            i_vpdFruPath + "\'");
+        o_errCode = error_code::FRU_PATH_NOT_FOUND;
         return false;
     }