diff --git a/framework/src/utils/InputParameters.C b/framework/src/utils/InputParameters.C index 6ab5b6697b15..ebc2a229c5a0 100644 --- a/framework/src/utils/InputParameters.C +++ b/framework/src/utils/InputParameters.C @@ -1156,6 +1156,10 @@ InputParameters::applyParameter(const InputParameters & common, // the parameter in the action at(local_name)._hit_node = common.getHitNode(common_name); } + else if (!local_exist && !common_exist) + mooseError("InputParameters::applyParameter(): Attempted to apply invalid parameter \"", + common_name, + "\""); // Enable deprecated message printing _show_deprecated_message = true; diff --git a/unit/src/InputParametersTest.C b/unit/src/InputParametersTest.C index 7558fb479881..6c507a8ef59d 100644 --- a/unit/src/InputParametersTest.C +++ b/unit/src/InputParametersTest.C @@ -182,6 +182,9 @@ TEST(InputParametersTest, applyParameter) p2.set("enum") = "bar"; p1.applyParameter(p2, "enum"); EXPECT_TRUE(p1.get("enum").contains("bar")); + + // applyParameter should throw error if input parameter doesn't match any valid parameters + EXPECT_THROW(p1.applyParameter(p2, "invalid_param"), std::exception); } TEST(InputParametersTest, applyParametersVector)