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

Update invalid parameter exception handling #2347

Merged
merged 4 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion nav2_costmap_2d/test/unit/declare_parameter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TEST(DeclareParameter, useInvalidParameter)
try {
layer.declareParameter("test2", rclcpp::PARAMETER_STRING);
FAIL() << "Incorrectly handling test_layer.test2 parameter which was not set";
} catch (rclcpp::exceptions::NoParameterOverrideProvided & ex) {
} catch (rclcpp::exceptions::ParameterUninitializedException & ex) {
jacobperron marked this conversation as resolved.
Show resolved Hide resolved
SUCCEED();
}
}
4 changes: 2 additions & 2 deletions nav2_util/include/nav2_util/node_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void declare_parameter_if_not_declared(
/* Declares static ROS2 parameter with given type if it was not already declared.
* NOTE: The parameter should be set via input param-file
* or throught a command-line. Otherwise according to the RCLCPP API,
* NoParameterOverrideProvided exception will be thrown by declare_parameter().
* ParameterUninitializedException exception will be thrown by declare_parameter().
*
* \param[in] node A node in which given parameter to be declared
* \param[in] param_type The type of parameter
Expand Down Expand Up @@ -142,7 +142,7 @@ std::string get_plugin_type_param(
{
try {
declare_parameter_if_not_declared(node, plugin_name + ".plugin", rclcpp::PARAMETER_STRING);
} catch (rclcpp::exceptions::NoParameterOverrideProvided & ex) {
} catch (rclcpp::exceptions::ParameterUninitialized & ex) {
RCLCPP_FATAL(node->get_logger(), "'plugin' param not defined for %s", plugin_name.c_str());
exit(-1);
}
Expand Down