use nholmann json exceptions instead of std
nholmann::json::at() will throw nholmann::json::out_of_range instead
of std::out_of_range. This resulted in missed exceptions in the
signature filtering code.
Change-Id: I573e1ed4455bbda4f05c100edd315eb0ccdc9c3f
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index 19429f4..1db3efe 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -128,7 +128,17 @@
// Filter for root cause attention.
libhei::Signature rootCause{};
RasDataParser rasData{};
- bool attnFound = filterRootCause(i_type, isoData, rootCause, rasData);
+ bool attnFound = false;
+ try
+ {
+ attnFound = filterRootCause(i_type, isoData, rootCause, rasData);
+ }
+ catch (const std::exception& e)
+ {
+ trace::err("Exception caught during root cause filtering");
+ trace::err(e.what());
+ attnFound = false; // just in case
+ }
// If a root cause attention was found, or if this was a system checkstop,
// generate a PEL.
diff --git a/analyzer/ras-data/ras-data-parser.cpp b/analyzer/ras-data/ras-data-parser.cpp
index c631cad..8b7e482 100644
--- a/analyzer/ras-data/ras-data-parser.cpp
+++ b/analyzer/ras-data/ras-data-parser.cpp
@@ -146,7 +146,7 @@
o_isFlagSet = true;
}
}
- catch (const std::out_of_range& e)
+ catch (const nlohmann::json::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
@@ -162,7 +162,7 @@
{
__checkActionForFlag(action, strFlag, data);
}
- catch (const std::out_of_range& e)
+ catch (const nlohmann::json::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
@@ -310,7 +310,7 @@
action =
i_data.at("signatures").at(id).at(bit).at(inst).get<std::string>();
}
- catch (const std::out_of_range& e)
+ catch (const nlohmann::json::out_of_range& e)
{
trace::err("No action defined for signature: %s %s %s", id.c_str(),
bit.c_str(), inst.c_str());