-
Notifications
You must be signed in to change notification settings - Fork 166
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
[rcl] Refactor error checking #321
Conversation
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! Looks like I have some changes to apply to #319.
@jacobperron wait sets still keep the fuzzy distinction between invalid argument and invalid entity, see here. |
Is this ready for review? |
Sure :) |
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, other than one question
RCL_CHECK_FOR_NULL_WITH_MSG( | ||
client->impl, "client's rmw implementation is invalid", return false); | ||
options = _client_get_options(client); | ||
RCL_CHECK_FOR_NULL_WITH_MSG( | ||
options, "client's options pointer is invalid", return false); |
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.
What's the rationale for removing the check of the options? Does it prevent this functions reuse somewhere else or something?
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.
I thought it was redundant since options
is not a pointer in the underlying impl struct, which is already checked in the line above.
The private function _client_get_options()
returns the address, and the user-facing rcl_client_get_options()
calls rcl_client_is_valid()
anyways.
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.
Makes sense, 👍
_is_valid()
function (if such a function exists).RCL_RET_INVALID_ARGUMENT
withRCL_RET_*_INVALID
where possible.RCL_RET_BAD_ALLOC
where appropriate.