-
Notifications
You must be signed in to change notification settings - Fork 225
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
Conversation
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>
@@ -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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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()
.
There was a problem hiding this 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
The main change here is the use of RCLError to replace the repeated pattern of fetching the RCL error string.