Create regulators RunRuleAction class
Create the RunRuleAction class that implements the run_rule action in
the JSON config file.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I382d072f6648f7609b0eb2b4e8a51b7fb18d54db
diff --git a/phosphor-regulators/src/actions/action_environment.hpp b/phosphor-regulators/src/actions/action_environment.hpp
index eb66981..ff6259a 100644
--- a/phosphor-regulators/src/actions/action_environment.hpp
+++ b/phosphor-regulators/src/actions/action_environment.hpp
@@ -165,12 +165,15 @@
* Throws runtime_error if the new depth exceeds maxRuleDepth. This
* indicates that infinite recursion has probably occurred (rule A -> rule B
* -> rule A).
+ *
+ * @param ruleID ID of the rule that is being called
*/
- void incrementRuleDepth()
+ void incrementRuleDepth(const std::string& ruleID)
{
if (ruleDepth >= maxRuleDepth)
{
- throw std::runtime_error("Maximum rule depth exceeded.");
+ throw std::runtime_error("Maximum rule depth exceeded by rule " +
+ ruleID + '.');
}
++ruleDepth;
}