commit | 23f091e566e8b72110d43346ed7b3db8c0fcb622 | [log] [tgz] |
---|---|---|
author | Jagpal Singh Gill <paligill@gmail.com> | Sun Dec 10 15:23:19 2023 -0800 |
committer | Jagpal Singh Gill <paligill@gmail.com> | Thu Feb 08 13:34:13 2024 -0800 |
tree | 997b94c34d37503dad263275e3f3c959159b0459 | |
parent | 7e11ab0a1155be4f3a2b9c185bd16d9d8b602fd9 [diff] [blame] |
add health_metric implementation Add the interface and implementation for the health_metric to be used in the rewrite for phosphor-health-monitor. This change is in relation to following design and D-Bus interface update - https://gerrit.openbmc.org/c/openbmc/docs/+/64917 https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64914 gtest added for UT. Change-Id: Iffcc52f9dff712890377b1222fd7e7d5d6661eaf Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_metric_config.cpp b/health_metric_config.cpp index 8320f25..2c0c78c 100644 --- a/health_metric_config.cpp +++ b/health_metric_config.cpp
@@ -5,6 +5,7 @@ #include <nlohmann/json.hpp> #include <phosphor-logging/lg2.hpp> +#include <cmath> #include <fstream> #include <unordered_map> #include <utility> @@ -79,6 +80,10 @@ } auto config = value.template get<Threshold>(); + if (!std::isfinite(config.value)) + { + throw std::invalid_argument("Invalid threshold value"); + } // ThresholdIntf::Bound::Upper is the only use case for // ThresholdIntf::Bound