File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,6 +206,14 @@ class UnknownROSArgsError : public std::runtime_error
206206 const std::vector<std::string> unknown_ros_args;
207207};
208208
209+ // / Thrown when an unknown type is passed
210+ class UnknownTypeError : public std ::runtime_error
211+ {
212+ public:
213+ explicit UnknownTypeError (const std::string & type)
214+ : std::runtime_error(" Unknown type: " + type) {}
215+ };
216+
209217// / Thrown when an invalid rclcpp::Event object or SharedPtr is encountered.
210218class InvalidEventError : public std ::runtime_error
211219{
Original file line number Diff line number Diff line change 2424
2525#include " rcl_interfaces/msg/parameter_type.hpp"
2626#include " rcl_interfaces/msg/parameter_value.hpp"
27+ #include " rclcpp/exceptions/exceptions.hpp"
2728#include " rclcpp/visibility_control.hpp"
2829
2930namespace rclcpp
Original file line number Diff line number Diff line change @@ -129,8 +129,7 @@ ParameterValue::ParameterValue(const rcl_interfaces::msg::ParameterValue & value
129129 case PARAMETER_NOT_SET:
130130 break ;
131131 default :
132- // TODO(wjwwood): use custom exception
133- throw std::runtime_error (" Unknown type: " + std::to_string (value.type ));
132+ throw rclcpp::exceptions::UnknownTypeError (std::to_string (value.type ));
134133 }
135134}
136135
You can’t perform that action at this time.
0 commit comments