Skip to content

Commit

Permalink
Add throwing parameter name if parameter is not set (#833)
Browse files Browse the repository at this point in the history
* added throwing parameter name if parameter is not set

Signed-off-by: Alex <cvbn127@gmail.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
  • Loading branch information
ivanpauno committed Sep 10, 2019
1 parent 925460d commit 64c0f86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rclcpp/include/rclcpp/parameter_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ class SyncParametersClient
{
return get_parameter_impl(
parameter_name,
std::function<T()>([]() -> T {throw std::runtime_error("Parameter not set");}));
std::function<T()>([&parameter_name]() -> T
{
throw std::runtime_error("Parameter '" + parameter_name + "' is not set");
})
);
}

RCLCPP_PUBLIC
Expand Down

0 comments on commit 64c0f86

Please sign in to comment.