From 436514ad1f9748551469dc206ea869a9d0a3c703 Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Tue, 13 Dec 2016 21:37:02 -0800 Subject: [PATCH] change exception message for windows ci bug change exception message for windows ci bug --- .../src/lifecycle_node_interface_impl.hpp | 10 ++++++---- rclcpp_lifecycle/test/test_callback_exceptions.cpp | 12 ++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp b/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp index ef30855ac5..ea66d4ad54 100644 --- a/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp +++ b/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp @@ -333,10 +333,12 @@ class LifecycleNode::LifecycleNodeInterfaceImpl auto callback = it->second; try { cb_success = callback(State(previous_state)); - } catch (const std::exception & e) { - fprintf(stderr, "Caught exception in callback for transition %d\n", - it->first); - fprintf(stderr, "Original error msg: %s\n", e.what()); + } catch (const std::exception &) { + // TODO(karsten1987): Windows CI doens't let me print the msg here + // the todo is to forward the exception to the on_error callback + // fprintf(stderr, "Caught exception in callback for transition %d\n", + // it->first); + // fprintf(stderr, "Original error msg: %s\n", e.what()); // maybe directly go for error handling here // and pass exception along with it cb_success = RCL_LIFECYCLE_RET_ERROR; diff --git a/rclcpp_lifecycle/test/test_callback_exceptions.cpp b/rclcpp_lifecycle/test/test_callback_exceptions.cpp index c3450153cc..60fcfa2b89 100644 --- a/rclcpp_lifecycle/test/test_callback_exceptions.cpp +++ b/rclcpp_lifecycle/test/test_callback_exceptions.cpp @@ -49,13 +49,11 @@ class PositiveCallbackExceptionNode : public rclcpp_lifecycle::LifecycleNode rcl_lifecycle_ret_t on_configure(const rclcpp_lifecycle::State &) { ++number_of_callbacks; - throw std::runtime_error("On_configure exception"); + throw std::runtime_error("custom exception raised in configure callback"); } - rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State & previous_state) + rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State &) { - fprintf(stderr, "Previous state of error was %s\n", - previous_state.label().c_str()); ++number_of_callbacks; return RCL_LIFECYCLE_RET_OK; } @@ -84,13 +82,11 @@ class NegativeCallbackExceptionNode : public rclcpp_lifecycle::LifecycleNode rcl_lifecycle_ret_t on_configure(const rclcpp_lifecycle::State &) { ++number_of_callbacks; - throw std::runtime_error("On_configure exception"); + throw std::runtime_error("custom exception raised in configure callback"); } - rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State & previous_state) + rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State &) { - fprintf(stderr, "Previous state of error was %s\n", - previous_state.label().c_str()); ++number_of_callbacks; return RCL_LIFECYCLE_RET_FAILURE; }