Skip to content

Commit 1b4361d

Browse files
committed
Client
Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
1 parent f414b2d commit 1b4361d

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

rmw_microxrcedds_c/src/rmw_client.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <rmw/allocators.h>
2525

2626
#include "./rmw_microros_internal/utils.h"
27+
#include "./rmw_microros_internal/error_handling_internal.h"
2728

2829
rmw_client_t *
2930
rmw_create_client(
@@ -34,20 +35,20 @@ rmw_create_client(
3435
{
3536
rmw_client_t * rmw_client = NULL;
3637
if (!node) {
37-
RMW_SET_ERROR_MSG("node handle is null");
38+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "node handle is null", 0);
3839
} else if (!type_support) {
39-
RMW_SET_ERROR_MSG("type support is null");
40+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "type support is null", 0);
4041
} else if (!is_uxrce_rmw_identifier_valid(node->implementation_identifier)) {
41-
RMW_SET_ERROR_MSG("node handle not from this implementation");
42+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "node handle not from this implementation", 0);
4243
} else if (!service_name || strlen(service_name) == 0) {
43-
RMW_SET_ERROR_MSG("service name is null or empty string");
44+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "service name is null or empty string", 0);
4445
} else if (!qos_policies) {
45-
RMW_SET_ERROR_MSG("qos_profile is null");
46+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "qos_profile is null", 0);
4647
} else {
4748
rmw_uxrce_node_t * custom_node = (rmw_uxrce_node_t *)node->data;
4849
rmw_uxrce_mempool_item_t * memory_node = get_memory(&client_memory);
4950
if (!memory_node) {
50-
RMW_SET_ERROR_MSG("Not available memory node");
51+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "Not available memory node", 0);
5152
return NULL;
5253
}
5354
rmw_uxrce_client_t * custom_client = (rmw_uxrce_client_t *)memory_node->data;
@@ -57,7 +58,7 @@ rmw_create_client(
5758
rmw_client->implementation_identifier = rmw_get_implementation_identifier();
5859
rmw_client->service_name = custom_client->service_name;
5960
if ((strlen(service_name) + 1 ) > sizeof(custom_client->service_name)) {
60-
RMW_SET_ERROR_MSG("failed to allocate string");
61+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "failed to allocate string", 0);
6162
goto fail;
6263
}
6364

@@ -79,15 +80,15 @@ rmw_create_client(
7980
}
8081
#endif /* ifdef ROSIDL_TYPESUPPORT_MICROXRCEDDS_CPP__IDENTIFIER_VALUE */
8182
if (NULL == type_support_xrce) {
82-
RMW_SET_ERROR_MSG("Undefined type support");
83+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "Undefined type support", 0);
8384
goto fail;
8485
}
8586

8687
custom_client->type_support_callbacks =
8788
(const service_type_support_callbacks_t *)type_support_xrce->data;
8889

8990
if (custom_client->type_support_callbacks == NULL) {
90-
RMW_SET_ERROR_MSG("type support data is NULL");
91+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "type support data is NULL", 0);
9192
goto fail;
9293
}
9394

@@ -108,7 +109,7 @@ rmw_create_client(
108109
custom_client->type_support_callbacks, qos_policies, rmw_uxrce_entity_naming_buffer,
109110
sizeof(rmw_uxrce_entity_naming_buffer)))
110111
{
111-
RMW_SET_ERROR_MSG("failed to generate xml request for client creation");
112+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_CREATION, "failed to generate xml request for client creation", 0);
112113
goto fail;
113114
}
114115
client_req = uxr_buffer_create_requester_xml(
@@ -189,22 +190,22 @@ rmw_destroy_client(
189190
{
190191
rmw_ret_t result_ret = RMW_RET_OK;
191192
if (!node) {
192-
RMW_SET_ERROR_MSG("node handle is null");
193+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_DESTRUCTION, "node handle is null", 0);
193194
result_ret = RMW_RET_ERROR;
194195
} else if (!is_uxrce_rmw_identifier_valid(node->implementation_identifier)) {
195-
RMW_SET_ERROR_MSG("node handle not from this implementation");
196+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_DESTRUCTION, "node handle not from this implementation", 0);
196197
result_ret = RMW_RET_ERROR;
197198
} else if (!node->data) {
198-
RMW_SET_ERROR_MSG("node imp is null");
199+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_DESTRUCTION, "node imp is null", 0);
199200
result_ret = RMW_RET_ERROR;
200201
} else if (!client) {
201-
RMW_SET_ERROR_MSG("client handle is null");
202+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_DESTRUCTION, "client handle is null", 0);
202203
result_ret = RMW_RET_ERROR;
203204
} else if (!is_uxrce_rmw_identifier_valid(client->implementation_identifier)) {
204-
RMW_SET_ERROR_MSG("client handle not from this implementation");
205+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_DESTRUCTION, "client handle not from this implementation", 0);
205206
result_ret = RMW_RET_ERROR;
206207
} else if (!client->data) {
207-
RMW_SET_ERROR_MSG("client imp is null");
208+
RMW_UROS_TRACE_ERROR(RMW_UROS_ERROR_ON_CLIENT, RMW_UROS_ERROR_ENTITY_DESTRUCTION, "client imp is null", 0);
208209
result_ret = RMW_RET_ERROR;
209210
} else {
210211
rmw_uxrce_node_t * custom_node = (rmw_uxrce_node_t *)node->data;

0 commit comments

Comments
 (0)