From 3160c181f7cf54a199d4ca50a8186397a3448c5c Mon Sep 17 00:00:00 2001 From: Lobotuerk Date: Fri, 11 Sep 2020 16:42:42 -0300 Subject: [PATCH] Update rmw_publish() error returns (#239) Signed-off-by: lobotuerk --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index 1e710e17..f6b2c7b9 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -1505,9 +1505,15 @@ extern "C" rmw_ret_t rmw_publish( rmw_publisher_allocation_t * allocation) { static_cast(allocation); // unused - RET_NULL(publisher); - RET_WRONG_IMPLID(publisher); - RET_NULL(ros_message); + RMW_CHECK_FOR_NULL_WITH_MSG( + publisher, "publisher handle is null", + return RMW_RET_INVALID_ARGUMENT); + RMW_CHECK_TYPE_IDENTIFIERS_MATCH( + publisher, publisher->implementation_identifier, eclipse_cyclonedds_identifier, + return RMW_RET_INCORRECT_RMW_IMPLEMENTATION); + RMW_CHECK_FOR_NULL_WITH_MSG( + ros_message, "ros message handle is null", + return RMW_RET_INVALID_ARGUMENT); auto pub = static_cast(publisher->data); assert(pub); if (dds_write(pub->enth, ros_message) >= 0) {