Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added error for when no parameter fits #29734

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions framework/src/utils/InputParameters.C
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,8 @@ 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("Attempted to apply invalid parameter \"", common_name, "\"");

// Enable deprecated message printing
_show_deprecated_message = true;
Expand Down
3 changes: 3 additions & 0 deletions unit/src/InputParametersTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ TEST(InputParametersTest, applyParameter)
p2.set<MultiMooseEnum>("enum") = "bar";
p1.applyParameter(p2, "enum");
EXPECT_TRUE(p1.get<MultiMooseEnum>("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)
Expand Down