Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Handle typesupport errors on retrieval. (#483)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <[email protected]>
  • Loading branch information
hidmic authored Dec 15, 2020
1 parent 58c1421 commit 3a0baf5
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions rmw_connext_cpp/src/type_support_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <string>
#include <sstream>

#include "rcutils/error_handling.h"

#include "rmw/allocators.h"
#include "rmw/error_handling.h"

Expand All @@ -37,20 +39,29 @@
get_message_typesupport_handle( \
TYPE_SUPPORTS, rosidl_typesupport_connext_c__identifier); \
if (!TYPE_SUPPORT) { \
rcutils_error_string_t prev_error_string = rcutils_get_error_string(); \
rcutils_reset_error(); \
TYPE_SUPPORT = get_message_typesupport_handle( \
TYPE_SUPPORTS, rosidl_typesupport_connext_cpp::typesupport_identifier); \
if (!TYPE_SUPPORT) { \
rcutils_error_string_t error_string = rcutils_get_error_string(); \
rcutils_reset_error(); \
char __msg[1024]; \
snprintf( \
__msg, 1024, \
"type support handle implementation '%s' (%p) does not match valid type supports " \
"('%s' (%p), '%s' (%p))", \
"Type support handle implementation '%s' (%p) does not match valid type supports " \
"('%s' (%p), '%s' (%p)). Got:\n" \
" %s\n" \
" %s\n" \
"while fetching", \
TYPE_SUPPORTS->typesupport_identifier, \
static_cast<const void *>(TYPE_SUPPORTS->typesupport_identifier), \
rosidl_typesupport_connext_cpp::typesupport_identifier, \
static_cast<const void *>(rosidl_typesupport_connext_cpp::typesupport_identifier), \
rosidl_typesupport_connext_c__identifier, \
static_cast<const void *>(rosidl_typesupport_connext_c__identifier)); \
static_cast<const void *>(rosidl_typesupport_connext_c__identifier), \
prev_error_string.str, \
error_string.str); \
RMW_SET_ERROR_MSG(__msg); \
return RET_VAL; \
} \
Expand All @@ -65,20 +76,29 @@
get_service_typesupport_handle( \
TYPE_SUPPORTS, rosidl_typesupport_connext_c__identifier); \
if (!TYPE_SUPPORT) { \
rcutils_error_string_t prev_error_string = rcutils_get_error_string(); \
rcutils_reset_error(); \
TYPE_SUPPORT = get_service_typesupport_handle( \
TYPE_SUPPORTS, rosidl_typesupport_connext_cpp::typesupport_identifier); \
if (!TYPE_SUPPORT) { \
rcutils_error_string_t error_string = rcutils_get_error_string(); \
rcutils_reset_error(); \
char __msg[1024]; \
snprintf( \
__msg, 1024, \
"type support handle implementation '%s' (%p) does not match valid type supports " \
"('%s' (%p), '%s' (%p))", \
"('%s' (%p), '%s' (%p)). Got:\n" \
" %s\n" \
" %s\n" \
"while fetching", \
TYPE_SUPPORTS->typesupport_identifier, \
static_cast<const void *>(TYPE_SUPPORTS->typesupport_identifier), \
rosidl_typesupport_connext_cpp::typesupport_identifier, \
static_cast<const void *>(rosidl_typesupport_connext_cpp::typesupport_identifier), \
rosidl_typesupport_connext_c__identifier, \
static_cast<const void *>(rosidl_typesupport_connext_c__identifier)); \
static_cast<const void *>(rosidl_typesupport_connext_c__identifier), \
prev_error_string.str, \
error_string.str); \
RMW_SET_ERROR_MSG(__msg); \
return RET_VAL; \
} \
Expand Down

0 comments on commit 3a0baf5

Please sign in to comment.