From 8e729a90ba4834a316bc7acd4d6398ceafa0cda7 Mon Sep 17 00:00:00 2001 From: ivanpauno Date: Thu, 29 Aug 2019 17:36:32 -0300 Subject: [PATCH 1/3] Return specific error when node is not found Signed-off-by: ivanpauno --- rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp index 414e174708..b98c31431c 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp @@ -85,7 +85,7 @@ rmw_ret_t __get_guid_by_name( kLoggerTag, "Unable to find GUID for node: %s", node_name); RMW_SET_ERROR_MSG("Unable to find GUID for node "); - return RMW_RET_ERROR; + return RMW_RET_NON_EXISTENT_NODE_NAME; } guid = guid_node_pair->first; } From 2c9808e1f3397b89e0b2583133f99be3bc61f4f4 Mon Sep 17 00:00:00 2001 From: ivanpauno Date: Fri, 30 Aug 2019 12:13:44 -0300 Subject: [PATCH 2/3] Stop logging error. Set better error message Signed-off-by: ivanpauno --- rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp index b98c31431c..fb90899f5a 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp @@ -81,11 +81,8 @@ rmw_ret_t __get_guid_by_name( }); if (guid_node_pair == impl->listener->discovered_names.end()) { - RCUTILS_LOG_ERROR_NAMED( - kLoggerTag, - "Unable to find GUID for node: %s", node_name); - RMW_SET_ERROR_MSG("Unable to find GUID for node "); - return RMW_RET_NON_EXISTENT_NODE_NAME; + RMW_SET_ERROR_MSG("Node name not found: ns='%s', name='%s", node_namespace, node_name); + return RMW_RET_NODE_NAME_NON_EXISTENT; } guid = guid_node_pair->first; } From e3e5ce2ad2ff6a32023c16539cd78c87eb5c6fe9 Mon Sep 17 00:00:00 2001 From: ivanpauno Date: Fri, 30 Aug 2019 16:56:45 -0300 Subject: [PATCH 3/3] Corrected errorgit add * Signed-off-by: ivanpauno --- rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp index fb90899f5a..34d67049ca 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp @@ -81,7 +81,11 @@ rmw_ret_t __get_guid_by_name( }); if (guid_node_pair == impl->listener->discovered_names.end()) { - RMW_SET_ERROR_MSG("Node name not found: ns='%s', name='%s", node_namespace, node_name); + RMW_SET_ERROR_MSG_WITH_FORMAT_STRING( + "Node name not found: ns='%s', name='%s", + node_namespace, + node_name + ); return RMW_RET_NODE_NAME_NON_EXISTENT; } guid = guid_node_pair->first;