summaryrefslogtreecommitdiffstats
path: root/ipmi_fru_info_area.cpp
diff options
context:
space:
mode:
authorOskar Senft <osk@google.com>2018-12-17 16:26:32 -0500
committerOskar Senft <osk@google.com>2019-02-11 18:25:16 +0000
commitcf059392984d089b9044250e44f7ac039c5b032d (patch)
treed04d555df8b488758e367c99926214f58919849b /ipmi_fru_info_area.cpp
parent3342a8e0876909b34c076172727b8cac861f5277 (diff)
downloadphosphor-host-ipmid-cf059392984d089b9044250e44f7ac039c5b032d.tar.gz
phosphor-host-ipmid-cf059392984d089b9044250e44f7ac039c5b032d.zip
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>
Diffstat (limited to 'ipmi_fru_info_area.cpp')
-rw-r--r--ipmi_fru_info_area.cpp12
1 files changed, 11 insertions, 1 deletions
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 @@ void appendChassisType(const PropertyMap& propMap, FruAreaData& data)
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);
}
OpenPOWER on IntegriCloud