ipmi_fru_info_area: Handle exception during parsing of chassis type
This is a fix for 40f59e2c50572705496ae743577f124f24afd77e.
Change-Id: I850f87968600759c2758841803ebd23c0856319d
Signed-off-by: Oskar Senft <osk@google.com>
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp
index 089a7cb..47a8a8e 100644
--- a/ipmi_fru_info_area.cpp
+++ b/ipmi_fru_info_area.cpp
@@ -135,7 +135,17 @@
if (iter != propMap.end())
{
auto value = iter->second;
- chassisType = std::stoi(value);
+ try
+ {
+ chassisType = std::stoi(value);
+ }
+ catch (std::exception& e)
+ {
+ log<level::ERR>("Could not parse chassis type",
+ entry("VALUE=%s", value.c_str()),
+ entry("ERROR=%s", e.what()));
+ chassisType = 0;
+ }
}
data.emplace_back(chassisType);
}