Merge pull request #366 from ros2/reset_error_code_init_failed
reset error code before throwing in rclcpp::utilities::init
This commit is contained in:
		
						commit
						f175726b0e
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -163,10 +163,10 @@ rclcpp::utilities::init(int argc, char * argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  g_is_interrupted.store(false);
 | 
					  g_is_interrupted.store(false);
 | 
				
			||||||
  if (rcl_init(argc, argv, rcl_get_default_allocator()) != RCL_RET_OK) {
 | 
					  if (rcl_init(argc, argv, rcl_get_default_allocator()) != RCL_RET_OK) {
 | 
				
			||||||
    // *INDENT-OFF* (prevent uncrustify from making unnecessary indents here)
 | 
					    std::string msg = "failed to initialize rmw implementation: ";
 | 
				
			||||||
    throw std::runtime_error(
 | 
					    msg += rcl_get_error_string_safe();
 | 
				
			||||||
      std::string("failed to initialize rmw implementation: ") + rcl_get_error_string_safe());
 | 
					    rcl_reset_error();
 | 
				
			||||||
    // *INDENT-ON*
 | 
					    throw std::runtime_error(msg);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#ifdef HAS_SIGACTION
 | 
					#ifdef HAS_SIGACTION
 | 
				
			||||||
  struct sigaction action;
 | 
					  struct sigaction action;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue