From 25eeffdfcc23d6d0a6f1bf55b87857e542a073d9 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Thu, 5 Sep 2019 11:59:18 -0700 Subject: [PATCH] Fixe error messages not printing to terminal (#777) (#847) * Uncommented catch exception code to print error Signed-off-by: Yathartha Tuladhar * put back the e Signed-off-by: Yathartha Tuladhar * uncommented error printing in exception handling Signed-off-by: Yathartha Tuladhar * Removed "/n" characters. Update lifecycle_node_interface_impl.hpp Signed-off-by: Yathartha Tuladhar * Fix CI issue and remove TODO Signed-off-by: Jacob Perron --- .../src/lifecycle_node_interface_impl.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp b/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp index 16d5e954e5..c55a0b0467 100644 --- a/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp +++ b/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp @@ -425,14 +425,9 @@ class LifecycleNode::LifecycleNodeInterfaceImpl auto callback = it->second; try { cb_success = callback(State(previous_state)); - } catch (const std::exception &) { - // TODO(karsten1987): Windows CI doesn't let me print the msg here - // the todo is to forward the exception to the on_error callback - // RCUTILS_LOG_ERROR("Caught exception in callback for transition %d\n", - // it->first); - // RCUTILS_LOG_ERROR("Original error msg: %s\n", e.what()); - // maybe directly go for error handling here - // and pass exception along with it + } catch (const std::exception & e) { + RCUTILS_LOG_ERROR("Caught exception in callback for transition %d", it->first); + RCUTILS_LOG_ERROR("Original error: %s", e.what()); cb_success = node_interfaces::LifecycleNodeInterface::CallbackReturn::ERROR; } }