Skip to content

Clean up exceptions in _rclpy_action#685

Merged
cottsay merged 1 commit intomasterfrom
cottsay/pybind11_rclpy_action_exceptions
Mar 1, 2021
Merged

Clean up exceptions in _rclpy_action#685
cottsay merged 1 commit intomasterfrom
cottsay/pybind11_rclpy_action_exceptions

Conversation

@cottsay
Copy link
Copy Markdown
Member

@cottsay cottsay commented Feb 26, 2021

The main change here is the use of RCLError to replace the repeated pattern of fetching the RCL error string.

The main change here is the use of RCLError to replace the repeated
pattern of fetching the RCL error string.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added the enhancement New feature or request label Feb 26, 2021
@cottsay cottsay requested a review from sloretz February 26, 2021 19:50
@cottsay cottsay self-assigned this Feb 26, 2021
} else {
std::string error_text{"Unknown entity: "};
error_text += pyentity.name();
rcutils_reset_error();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the removal of this call, which I believe was unnecessary.

} else {
std::string error_text{"Unknown entity: "};
error_text += pyentity.name();
rcutils_reset_error();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before - I don't see why this was being called.

Comment on lines 419 to 409
error_text += rcl_get_error_string().str;
rcutils_reset_error();
rcl_reset_error();
throw py::value_error(error_text);
} else if (ret != RCL_RET_OK) {
std::string error_text{"Failed to create action client: "};
error_text += rcl_get_error_string().str;
rcutils_reset_error();
rcl_reset_error();
throw py::value_error(error_text);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note these changes - it doesn't make sense to call rcutils_reset_error() after rcl_get_error_string().

Copy link
Copy Markdown
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with green CI

@cottsay
Copy link
Copy Markdown
Member Author

cottsay commented Feb 27, 2021

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz sloretz mentioned this pull request Feb 27, 2021
34 tasks
@cottsay cottsay merged commit 75b91e6 into master Mar 1, 2021
@delete-merged-branch delete-merged-branch bot deleted the cottsay/pybind11_rclpy_action_exceptions branch March 1, 2021 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants