Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dashing backport] reset error message before setting a new one, embed the original one #505

Merged
merged 1 commit into from
Sep 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions rcl_lifecycle/src/rcl_lifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,20 @@ rcl_lifecycle_state_machine_fini(
rcl_ret_t fcn_ret = RCL_RET_OK;

if (rcl_lifecycle_com_interface_fini(&state_machine->com_interface, node_handle) != RCL_RET_OK) {
RCL_SET_ERROR_MSG("could not free lifecycle com interface. Leaking memory!\n");
rcl_error_string_t error_string = rcl_get_error_string();
rcutils_reset_error();
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
"could not free lifecycle com interface. Leaking memory!\n%s", error_string.str);
fcn_ret = RCL_RET_ERROR;
}

if (rcl_lifecycle_transition_map_fini(
&state_machine->transition_map, allocator) != RCL_RET_OK)
{
RCL_SET_ERROR_MSG("could not free lifecycle transition map. Leaking memory!\n");
rcl_error_string_t error_string = rcl_get_error_string();
rcutils_reset_error();
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
"could not free lifecycle transition map. Leaking memory!\n%s", error_string.str);
fcn_ret = RCL_RET_ERROR;
}

Expand Down Expand Up @@ -333,7 +339,9 @@ _trigger_transition(
rcl_ret_t ret = rcl_lifecycle_com_interface_publish_notification(
&state_machine->com_interface, transition->start, state_machine->current_state);
if (ret != RCL_RET_OK) {
RCL_SET_ERROR_MSG("Could not publish transition");
rcl_error_string_t error_string = rcl_get_error_string();
rcutils_reset_error();
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING("Could not publish transition: %s", error_string.str);
return RCL_RET_ERROR;
}
}
Expand Down