Skip to content

Commit

Permalink
Output rcl error message when yaml parsing fails (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhood committed Sep 14, 2018
1 parent 80595f3 commit 86cc8fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -120,7 +121,11 @@ NodeParameters::NodeParameters(
throw std::bad_alloc();
}
if (!rcl_parse_yaml_file(yaml_path.c_str(), yaml_params)) {
throw std::runtime_error("Failed to parse parameters " + yaml_path);
std::ostringstream ss;
ss << "Failed to parse parameters from file '" << yaml_path << "': " <<
rcl_get_error_string_safe();
rcl_reset_error();
throw std::runtime_error(ss.str());
}

rclcpp::ParameterMap initial_map = rclcpp::parameter_map_from(yaml_params);
Expand Down

0 comments on commit 86cc8fd

Please sign in to comment.