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

Clean up exceptions in _rclpy_action #685

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

cottsay
Copy link
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
@@ -154,17 +151,14 @@ rclpy_action_wait_set_add(py::capsule pyentity, py::capsule pywait_set)
} else {
std::string error_text{"Unknown entity: "};
error_text += pyentity.name();
rcutils_reset_error();
Copy link
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.

@@ -212,17 +206,14 @@ rclpy_action_wait_set_get_num_entities(py::capsule pyentity)
} else {
std::string error_text{"Unknown entity: "};
error_text += pyentity.name();
rcutils_reset_error();
Copy link
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
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
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
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
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.

None yet

3 participants