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

Updated error returns on rmw_take_serialized and with_message_info #435

Merged
merged 2 commits into from
Sep 18, 2020
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
39 changes: 23 additions & 16 deletions rmw_fastrtps_shared_cpp/src/rmw_take.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ _take_serialized_message(
(void) allocation;
*taken = false;

if (subscription->implementation_identifier != identifier) {
RMW_SET_ERROR_MSG("publisher handle not from this implementation");
return RMW_RET_ERROR;
}
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
subscription handle,
subscription->implementation_identifier, identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION)

CustomSubscriberInfo * info = static_cast<CustomSubscriberInfo *>(subscription->data);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(info, "custom subscriber info is null", return RMW_RET_ERROR);
Expand Down Expand Up @@ -298,11 +298,14 @@ __rmw_take_serialized_message(
bool * taken,
rmw_subscription_allocation_t * allocation)
{
RCUTILS_CHECK_FOR_NULL_WITH_MSG(
subscription, "subscription pointer is null", return RMW_RET_ERROR);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(
serialized_message, "ros_message pointer is null", return RMW_RET_ERROR);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(taken, "boolean flag for taken is null", return RMW_RET_ERROR);
RMW_CHECK_ARGUMENT_FOR_NULL(
subscription, RMW_RET_INVALID_ARGUMENT);

RMW_CHECK_ARGUMENT_FOR_NULL(
serialized_message, RMW_RET_INVALID_ARGUMENT);

RMW_CHECK_ARGUMENT_FOR_NULL(
taken, RMW_RET_INVALID_ARGUMENT);

return _take_serialized_message(
identifier, subscription, serialized_message, taken, nullptr, allocation);
Expand All @@ -317,13 +320,17 @@ __rmw_take_serialized_message_with_info(
rmw_message_info_t * message_info,
rmw_subscription_allocation_t * allocation)
{
RCUTILS_CHECK_FOR_NULL_WITH_MSG(
subscription, "subscription pointer is null", return RMW_RET_ERROR);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(
serialized_message, "ros_message pointer is null", return RMW_RET_ERROR);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(taken, "boolean flag for taken is null", return RMW_RET_ERROR);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(
message_info, "message info pointer is null", return RMW_RET_ERROR);
RMW_CHECK_ARGUMENT_FOR_NULL(
subscription, RMW_RET_INVALID_ARGUMENT);

RMW_CHECK_ARGUMENT_FOR_NULL(
serialized_message, RMW_RET_INVALID_ARGUMENT);

RMW_CHECK_ARGUMENT_FOR_NULL(
taken, RMW_RET_INVALID_ARGUMENT);

RMW_CHECK_ARGUMENT_FOR_NULL(
message_info, RMW_RET_INVALID_ARGUMENT);

return _take_serialized_message(
identifier, subscription, serialized_message, taken, message_info, allocation);
Expand Down