Skip to content

Commit 49e9ed3

Browse files
committed
change exception message for windows ci bug
change exception message for windows ci bug
1 parent a08c736 commit 49e9ed3

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,12 @@ class LifecycleNode::LifecycleNodeInterfaceImpl
333333
auto callback = it->second;
334334
try {
335335
cb_success = callback(State(previous_state));
336-
} catch (const std::exception & e) {
337-
fprintf(stderr, "Caught exception in callback for transition %d\n",
338-
it->first);
339-
fprintf(stderr, "Original error msg: %s\n", e.what());
336+
} catch (const std::exception &) {
337+
// TODO(karsten1987): Windows CI doens't let me print the msg here
338+
// the todo is to forward the exception to the on_error callback
339+
// fprintf(stderr, "Caught exception in callback for transition %d\n",
340+
// it->first);
341+
// fprintf(stderr, "Original error msg: %s\n", e.what());
340342
// maybe directly go for error handling here
341343
// and pass exception along with it
342344
cb_success = RCL_LIFECYCLE_RET_ERROR;

rclcpp_lifecycle/test/test_callback_exceptions.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ class PositiveCallbackExceptionNode : public rclcpp_lifecycle::LifecycleNode
4949
rcl_lifecycle_ret_t on_configure(const rclcpp_lifecycle::State &)
5050
{
5151
++number_of_callbacks;
52-
throw std::runtime_error("On_configure exception");
52+
throw std::runtime_error("custom exception raised in configure callback");
5353
}
5454

55-
rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State & previous_state)
55+
rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State &)
5656
{
57-
fprintf(stderr, "Previous state of error was %s\n",
58-
previous_state.label().c_str());
5957
++number_of_callbacks;
6058
return RCL_LIFECYCLE_RET_OK;
6159
}
@@ -84,13 +82,11 @@ class NegativeCallbackExceptionNode : public rclcpp_lifecycle::LifecycleNode
8482
rcl_lifecycle_ret_t on_configure(const rclcpp_lifecycle::State &)
8583
{
8684
++number_of_callbacks;
87-
throw std::runtime_error("On_configure exception");
85+
throw std::runtime_error("custom exception raised in configure callback");
8886
}
8987

90-
rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State & previous_state)
88+
rcl_lifecycle_ret_t on_error(const rclcpp_lifecycle::State &)
9189
{
92-
fprintf(stderr, "Previous state of error was %s\n",
93-
previous_state.label().c_str());
9490
++number_of_callbacks;
9591
return RCL_LIFECYCLE_RET_FAILURE;
9692
}

0 commit comments

Comments
 (0)