Skip to content

Commit eb745b5

Browse files
authored
fix(gateway): log a missing type schema where the handler asks for it
The type schema provider logs a failed lookup under its own logger with the type name only. The data and operation handlers now log the miss at DEBUG under rest_server with the topic or type, and the topic transport logs it under the node logger, so --log-level rest_server:=debug shows which topic has no schema.
1 parent 99b4ad0 commit eb745b5

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎src/ros2_medkit_gateway/src/http/handlers/data_handlers.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ dto::XMedkitDataItem build_list_item_xmedkit(const std::string & topic_name, con
282282
ros2_meta.type = topic_type;
283283
if (auto type_info = type_schemas.type_info(topic_type)) {
284284
item_xm.type_info = std::move(*type_info);
285+
} else {
286+
MEDKIT_LOG_DEBUG(HandlerContext::logger(), "Could not get type info for topic '%s' (type '%s')",
287+
topic_name.c_str(), topic_type.c_str());
285288
}
286289
}
287290
item_xm.ros2 = ros2_meta;
@@ -327,6 +330,9 @@ dto::DataValue build_read_response(const std::string & item_id, const std::strin
327330
ros2_meta.type = sample.message_type;
328331
if (auto type_info = type_schemas.type_info(sample.message_type)) {
329332
xm.type_info = std::move(*type_info);
333+
} else {
334+
MEDKIT_LOG_DEBUG(HandlerContext::logger(), "Could not get type info for topic '%s' (type '%s')",
335+
full_topic_path.c_str(), sample.message_type.c_str());
330336
}
331337
}
332338
xm.ros2 = ros2_meta;

‎src/ros2_medkit_gateway/src/http/handlers/operation_handlers.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ dto::XMedkitOperationItem build_service_xmedkit(const ServiceInfo & svc, const s
380380
try {
381381
if (auto type_info = type_schemas.service_type_info(svc.type)) {
382382
x_medkit.type_info = *type_info;
383+
} else {
384+
MEDKIT_LOG_DEBUG(HandlerContext::logger(), "Could not get type info for service '%s'", svc.type.c_str());
383385
}
384386
} catch (const std::exception & e) {
385387
MEDKIT_LOG_DEBUG(HandlerContext::logger(), "Could not get type info for service '%s': %s", svc.type.c_str(),
@@ -405,6 +407,8 @@ dto::XMedkitOperationItem build_action_xmedkit(const ActionInfo & act, const std
405407
try {
406408
if (auto type_info = type_schemas.action_type_info(act.type)) {
407409
x_medkit.type_info = *type_info;
410+
} else {
411+
MEDKIT_LOG_DEBUG(HandlerContext::logger(), "Could not get type info for action '%s'", act.type.c_str());
408412
}
409413
} catch (const std::exception & e) {
410414
MEDKIT_LOG_DEBUG(HandlerContext::logger(), "Could not get type info for action '%s': %s", act.type.c_str(),

‎src/ros2_medkit_gateway/src/ros2/transports/ros2_topic_transport.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ TopicSample Ros2TopicTransport::sample(const std::string & topic_name, std::chro
157157
if (!res.message_type.empty()) {
158158
if (auto info = schemas_.type_info(res.message_type)) {
159159
out.type_info = std::move(*info);
160+
} else {
161+
RCLCPP_DEBUG(node_->get_logger(), "Could not get type info for topic '%s' (type '%s')", topic_name.c_str(),
162+
res.message_type.c_str());
160163
}
161164
}
162165

0 commit comments

Comments
 (0)