pldmtool: avoid map copy in FRU typeToString helper

Use const reference for typeToString map parameter in FRU decode
formatting to avoid an unnecessary map copy on each call.

Replace exception-based lookup (at + try/catch) with find-based
lookup for the expected fallback path when a key is absent.

No functional change intended.

Change-Id: I6a5b8322571e68c4cbb3103fd7f1a13a81295837
Signed-off-by: Meghana Vangapandu <meghanav@ami.com>
diff --git a/pldmtool/pldm_fru_cmd.cpp b/pldmtool/pldm_fru_cmd.cpp
index 5b23dff..1b3ac23 100644
--- a/pldmtool/pldm_fru_cmd.cpp
+++ b/pldmtool/pldm_fru_cmd.cpp
@@ -265,18 +265,17 @@
                      {"VR10", VR10FieldTypes}};
 #endif
 
-    std::string typeToString(std::map<uint8_t, std::string> typeMap,
+    std::string typeToString(const std::map<uint8_t, std::string>& typeMap,
                              uint8_t type)
     {
         auto typeString = std::to_string(type);
-        try
+        const auto it = typeMap.find(type);
+        if (it != typeMap.end())
         {
-            return std::string(typeMap.at(type)) + "(" + typeString + ")";
+            return it->second + "(" + typeString + ")";
         }
-        catch (const std::out_of_range& e)
-        {
-            return typeString;
-        }
+
+        return typeString;
     }
 
     std::string fruFieldValuestring(const uint8_t* value, uint8_t length)