@@ -977,6 +977,7 @@ controller_interface::ControllerInterfaceBaseSharedPtr ControllerManager::load_c
977977 get_logger (),
978978 " Caught exception of type : %s while loading the controller '%s' of plugin type '%s':\n %s" ,
979979 typeid (e).name (), controller_name.c_str (), controller_type.c_str (), e.what ());
980+ params_->handle_exceptions ? void () : throw ;
980981 return nullptr ;
981982 }
982983 catch (...)
@@ -1187,6 +1188,7 @@ controller_interface::return_type ControllerManager::cleanup_controller(
11871188 RCLCPP_ERROR (
11881189 get_logger (), " Caught exception while cleaning-up the controller '%s'" ,
11891190 controller.info .name .c_str ());
1191+ params_->handle_exceptions ? void () : throw ;
11901192 return controller_interface::return_type::ERROR;
11911193 }
11921194 return controller_interface::return_type::OK;
@@ -1211,12 +1213,14 @@ void ControllerManager::shutdown_controller(
12111213 get_logger (),
12121214 " Caught exception of type : %s while shutdown the controller '%s' before unloading: %s" ,
12131215 typeid (e).name (), controller.info .name .c_str (), e.what ());
1216+ params_->handle_exceptions ? void () : throw ;
12141217 }
12151218 catch (...)
12161219 {
12171220 RCLCPP_ERROR (
12181221 get_logger (), " Failed to shutdown the controller '%s' before unloading" ,
12191222 controller.info .name .c_str ());
1223+ params_->handle_exceptions ? void () : throw ;
12201224 }
12211225}
12221226
@@ -1287,13 +1291,15 @@ controller_interface::return_type ControllerManager::configure_controller(
12871291 RCLCPP_ERROR (
12881292 get_logger (), " Caught exception of type : %s while configuring controller '%s': %s" ,
12891293 typeid (e).name (), controller_name.c_str (), e.what ());
1294+ params_->handle_exceptions ? void () : throw ;
12901295 return controller_interface::return_type::ERROR;
12911296 }
12921297 catch (...)
12931298 {
12941299 RCLCPP_ERROR (
12951300 get_logger (), " Caught unknown exception while configuring controller '%s'" ,
12961301 controller_name.c_str ());
1302+ params_->handle_exceptions ? void () : throw ;
12971303 return controller_interface::return_type::ERROR;
12981304 }
12991305
@@ -1348,6 +1354,7 @@ controller_interface::return_type ControllerManager::configure_controller(
13481354 RCLCPP_FATAL (
13491355 get_logger (), " Export of the state or reference interfaces failed with following error: %s" ,
13501356 e.what ());
1357+ params_->handle_exceptions ? void () : throw ;
13511358 return controller_interface::return_type::ERROR;
13521359 }
13531360 resource_manager_->import_controller_reference_interfaces (controller_name, ref_interfaces);
@@ -2134,6 +2141,7 @@ controller_interface::ControllerInterfaceBaseSharedPtr ControllerManager::add_co
21342141 RCLCPP_ERROR (
21352142 get_logger (), " Caught exception of type : %s while initializing controller '%s': %s" ,
21362143 typeid (e).name (), controller.info .name .c_str (), e.what ());
2144+ params_->handle_exceptions ? void () : throw ;
21372145 return nullptr ;
21382146 }
21392147 catch (...)
@@ -2142,6 +2150,7 @@ controller_interface::ControllerInterfaceBaseSharedPtr ControllerManager::add_co
21422150 RCLCPP_ERROR (
21432151 get_logger (), " Caught unknown exception while initializing controller '%s'" ,
21442152 controller.info .name .c_str ());
2153+ params_->handle_exceptions ? void () : throw ;
21452154 return nullptr ;
21462155 }
21472156
@@ -2211,13 +2220,15 @@ void ControllerManager::deactivate_controllers(
22112220 RCLCPP_ERROR (
22122221 get_logger (), " Caught exception of type : %s while deactivating the controller '%s': %s" ,
22132222 typeid (e).name (), controller_name.c_str (), e.what ());
2223+ params_->handle_exceptions ? void () : throw ;
22142224 continue ;
22152225 }
22162226 catch (...)
22172227 {
22182228 RCLCPP_ERROR (
22192229 get_logger (), " Caught unknown exception while deactivating the controller '%s'" ,
22202230 controller_name.c_str ());
2231+ params_->handle_exceptions ? void () : throw ;
22212232 continue ;
22222233 }
22232234 }
@@ -2334,6 +2345,7 @@ void ControllerManager::activate_controllers(
23342345 " Caught exception of type : %s while claiming the command interfaces. Can't activate "
23352346 " controller '%s': %s" ,
23362347 typeid (e).name (), controller_name.c_str (), e.what ());
2348+ params_->handle_exceptions ? void () : throw ;
23372349 command_loans.clear ();
23382350 assignment_successful = false ;
23392351 break ;
@@ -2375,6 +2387,7 @@ void ControllerManager::activate_controllers(
23752387 " controller '%s': %s" ,
23762388 typeid (e).name (), controller_name.c_str (), e.what ());
23772389 assignment_successful = false ;
2390+ params_->handle_exceptions ? void () : throw ;
23782391 break ;
23792392 }
23802393 }
@@ -2398,12 +2411,14 @@ void ControllerManager::activate_controllers(
23982411 RCLCPP_ERROR (
23992412 get_logger (), " Caught exception of type : %s while activating the controller '%s': %s" ,
24002413 typeid (e).name (), controller_name.c_str (), e.what ());
2414+ params_->handle_exceptions ? void () : throw ;
24012415 }
24022416 catch (...)
24032417 {
24042418 RCLCPP_ERROR (
24052419 get_logger (), " Caught unknown exception while activating the controller '%s'" ,
24062420 controller_name.c_str ());
2421+ params_->handle_exceptions ? void () : throw ;
24072422 }
24082423 if (new_state.id () != lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
24092424 {
@@ -3128,13 +3143,15 @@ controller_interface::return_type ControllerManager::update(
31283143 RCLCPP_ERROR (
31293144 get_logger (), " Caught exception of type : %s while updating controller '%s': %s" ,
31303145 typeid (e).name (), loaded_controller.info .name .c_str (), e.what ());
3146+ params_->handle_exceptions ? void () : throw ;
31313147 controller_ret = controller_interface::return_type::ERROR;
31323148 }
31333149 catch (...)
31343150 {
31353151 RCLCPP_ERROR (
31363152 get_logger (), " Caught unknown exception while updating controller '%s'" ,
31373153 loaded_controller.info .name .c_str ());
3154+ params_->handle_exceptions ? void () : throw ;
31383155 controller_ret = controller_interface::return_type::ERROR;
31393156 }
31403157
0 commit comments