Refactor redfishPcieGenerationFromDbus and redfishSlotType

This commit refactors the redfishPcieGenerationFromDbus and
redfishSlotType functions by changing their return types. The return
value std::nullopt indicates that there is no output, while the return
value pcie_device::PCIeTypes::Invalid indicates that the input was
invalid and returns an internal error. Additionally, the code that calls
these functions has been updated to accommodate the changes.

Tested: Validator passed

Change-Id: I3f7c1a3c8c6b53fd9a39928e3ad9a5fed9be97ff
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index b63c850..82e1a5f 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -295,11 +295,18 @@
 
         if (!redfishGenerationInUse)
         {
-            messages::internalError(resp);
-            return;
+            BMCWEB_LOG_WARNING << "Unknown PCIe Device Generation: "
+                               << *generationInUse;
         }
-        if (*redfishGenerationInUse != pcie_device::PCIeTypes::Invalid)
+        else
         {
+            if (*redfishGenerationInUse == pcie_device::PCIeTypes::Invalid)
+            {
+                BMCWEB_LOG_ERROR << "Invalid PCIe Device Generation: "
+                                 << *generationInUse;
+                messages::internalError(resp);
+                return;
+            }
             resp.jsonValue["PCIeInterface"]["PCIeType"] =
                 *redfishGenerationInUse;
         }