@@ -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);
@@ -2133,6 +2140,7 @@ controller_interface::ControllerInterfaceBaseSharedPtr ControllerManager::add_co
21332140 RCLCPP_ERROR (
21342141 get_logger (), " Caught exception of type : %s while initializing controller '%s': %s" ,
21352142 typeid (e).name (), controller.info .name .c_str (), e.what ());
2143+ params_->handle_exceptions ? void () : throw ;
21362144 return nullptr ;
21372145 }
21382146 catch (...)
@@ -2141,6 +2149,7 @@ controller_interface::ControllerInterfaceBaseSharedPtr ControllerManager::add_co
21412149 RCLCPP_ERROR (
21422150 get_logger (), " Caught unknown exception while initializing controller '%s'" ,
21432151 controller.info .name .c_str ());
2152+ params_->handle_exceptions ? void () : throw ;
21442153 return nullptr ;
21452154 }
21462155
@@ -2210,13 +2219,15 @@ void ControllerManager::deactivate_controllers(
22102219 RCLCPP_ERROR (
22112220 get_logger (), " Caught exception of type : %s while deactivating the controller '%s': %s" ,
22122221 typeid (e).name (), controller_name.c_str (), e.what ());
2222+ params_->handle_exceptions ? void () : throw ;
22132223 continue ;
22142224 }
22152225 catch (...)
22162226 {
22172227 RCLCPP_ERROR (
22182228 get_logger (), " Caught unknown exception while deactivating the controller '%s'" ,
22192229 controller_name.c_str ());
2230+ params_->handle_exceptions ? void () : throw ;
22202231 continue ;
22212232 }
22222233 }
@@ -2333,6 +2344,7 @@ void ControllerManager::activate_controllers(
23332344 " Caught exception of type : %s while claiming the command interfaces. Can't activate "
23342345 " controller '%s': %s" ,
23352346 typeid (e).name (), controller_name.c_str (), e.what ());
2347+ params_->handle_exceptions ? void () : throw ;
23362348 command_loans.clear ();
23372349 assignment_successful = false ;
23382350 break ;
@@ -2374,6 +2386,7 @@ void ControllerManager::activate_controllers(
23742386 " controller '%s': %s" ,
23752387 typeid (e).name (), controller_name.c_str (), e.what ());
23762388 assignment_successful = false ;
2389+ params_->handle_exceptions ? void () : throw ;
23772390 break ;
23782391 }
23792392 }
@@ -2397,12 +2410,14 @@ void ControllerManager::activate_controllers(
23972410 RCLCPP_ERROR (
23982411 get_logger (), " Caught exception of type : %s while activating the controller '%s': %s" ,
23992412 typeid (e).name (), controller_name.c_str (), e.what ());
2413+ params_->handle_exceptions ? void () : throw ;
24002414 }
24012415 catch (...)
24022416 {
24032417 RCLCPP_ERROR (
24042418 get_logger (), " Caught unknown exception while activating the controller '%s'" ,
24052419 controller_name.c_str ());
2420+ params_->handle_exceptions ? void () : throw ;
24062421 }
24072422 if (new_state.id () != lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
24082423 {
@@ -3127,13 +3142,15 @@ controller_interface::return_type ControllerManager::update(
31273142 RCLCPP_ERROR (
31283143 get_logger (), " Caught exception of type : %s while updating controller '%s': %s" ,
31293144 typeid (e).name (), loaded_controller.info .name .c_str (), e.what ());
3145+ params_->handle_exceptions ? void () : throw ;
31303146 controller_ret = controller_interface::return_type::ERROR;
31313147 }
31323148 catch (...)
31333149 {
31343150 RCLCPP_ERROR (
31353151 get_logger (), " Caught unknown exception while updating controller '%s'" ,
31363152 loaded_controller.info .name .c_str ());
3153+ params_->handle_exceptions ? void () : throw ;
31373154 controller_ret = controller_interface::return_type::ERROR;
31383155 }
31393156
0 commit comments