reset error code before throwing in rclcpp::utilities::init

This commit is contained in:
Dirk Thomas 2017-08-31 16:41:05 -07:00
parent 8e2e64e82a
commit b28648c61d

View file

@ -163,10 +163,10 @@ rclcpp::utilities::init(int argc, char * argv[])
{
g_is_interrupted.store(false);
if (rcl_init(argc, argv, rcl_get_default_allocator()) != RCL_RET_OK) {
// *INDENT-OFF* (prevent uncrustify from making unnecessary indents here)
throw std::runtime_error(
std::string("failed to initialize rmw implementation: ") + rcl_get_error_string_safe());
// *INDENT-ON*
std::string msg = "failed to initialize rmw implementation: ";
msg += rcl_get_error_string_safe();
rcl_reset_error();
throw std::runtime_error(msg);
}
#ifdef HAS_SIGACTION
struct sigaction action;