impl: Capture record name on failed parse

This commit captures the record name on failed VPD parsing (when
applicable). The record name can then be captured in the
VpdDataException and recorded in the PEL that is logged.

Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: I96f1ded9b3dfb613ecf7c67f15cf7157647435fa
diff --git a/impl.cpp b/impl.cpp
index 900e0e8..a8bd694 100644
--- a/impl.cpp
+++ b/impl.cpp
@@ -148,13 +148,14 @@
 
     if (eccLength == 0 || eccOffset == 0)
     {
-        throw(VpdEccException("Could not find ECC's offset or Length."));
+        throw(VpdEccException(
+            "Could not find ECC's offset or Length for Record:"));
     }
 
     if (recordOffset == 0 || recordLength == 0)
     {
         throw(VpdDataException("Could not find VPD record offset or VPD record "
-                               "length."));
+                               "length for Record:"));
     }
 
     auto vpdPtr = vpd.cbegin();
@@ -276,28 +277,25 @@
             if (rc != eccStatus::SUCCESS)
             {
                 std::string errorMsg =
-                    std::string("ERROR: ECC check did not pass.");
+                    std::string("ERROR: ECC check did not pass for the "
+                                "Record:");
                 throw(VpdEccException(errorMsg));
             }
         }
         catch (const VpdEccException& ex)
         {
-            std::string errMsg =
-                std::string{ex.what()} + " Record: " + recordName;
-
             inventory::PelAdditionalData additionalData{};
-            additionalData.emplace("DESCRIPTION", errMsg);
+            additionalData.emplace("DESCRIPTION",
+                                   std::string{ex.what()} + recordName);
             additionalData.emplace("CALLOUT_INVENTORY_PATH", inventoryPath);
             createPEL(additionalData, PelSeverity::WARNING,
                       errIntfForEccCheckFail, nullptr);
         }
         catch (const VpdDataException& ex)
         {
-            std::string errMsg =
-                std::string{ex.what()} + " Record: " + recordName;
-
             inventory::PelAdditionalData additionalData{};
-            additionalData.emplace("DESCRIPTION", errMsg);
+            additionalData.emplace("DESCRIPTION",
+                                   std::string{ex.what()} + recordName);
             additionalData.emplace("CALLOUT_INVENTORY_PATH", inventoryPath);
             createPEL(additionalData, PelSeverity::WARNING,
                       errIntfForInvalidVPD, nullptr);