Exception handling with flags in ras-data-parser

It is possible that a signature may not be defined in the RAS data. In
which case, trying to access the flags for an undefined signature would
throw an exception. This is not the desired behavior. Instead, we'll
catch the exceptions and move on as if the flag is not defined.

Change-Id: I4d3cff52ce5f32074fca9863f60b84726dd590aa
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/analyzer/ras-data/ras-data-parser.cpp b/analyzer/ras-data/ras-data-parser.cpp
index 9a014fd..c631cad 100644
--- a/analyzer/ras-data/ras-data-parser.cpp
+++ b/analyzer/ras-data/ras-data-parser.cpp
@@ -4,6 +4,7 @@
 
 #include <filesystem>
 #include <fstream>
+#include <stdexcept>
 #include <string>
 
 namespace fs = std::filesystem;
@@ -131,7 +132,7 @@
     std::string bit{buf};
 
     // Get the list of flags in string format from the data.
-    if (data.at("signatures").at(id).at(bit).contains("flags"))
+    try
     {
         auto flags = data.at("signatures")
                          .at(id)
@@ -145,13 +146,28 @@
             o_isFlagSet = true;
         }
     }
+    catch (const std::out_of_range& e)
+    {
+        // Do nothing. Assume there is no flag defined. If for some reason
+        // the `id` or `bit` were not defined, that will be cause below when the
+        // signture is parsed.
+    }
 
     // If the flag hasn't been found, check if it was defined as part of the
     // action for this input signature.
     if (!o_isFlagSet)
     {
         const auto action = parseSignature(data, i_signature);
-        __checkActionForFlag(action, strFlag, data);
+        try
+        {
+            __checkActionForFlag(action, strFlag, data);
+        }
+        catch (const std::out_of_range& e)
+        {
+            // Again, do nothing. Assume there is no flag defined. If for some
+            // reason the action is not defined, that will be handled later when
+            // attempting to get the resolution.
+        }
     }
 
     return o_isFlagSet;