Output rcl error message when yaml parsing fails (#557)
This commit is contained in:
parent
80595f37d1
commit
86cc8fdb3a
1 changed files with 6 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue