Skip to content

Commit a13e16e

Browse files
Adding in topic name to logging on IPC issues (#2706)
* Adding in topic name to logging on IPC issues Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> * Update test matching output logging Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> * adding in single quotes Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> --------- Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
1 parent aad8cb5 commit a13e16e

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

rclcpp/include/rclcpp/publisher.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ class Publisher : public PublisherBase
147147
const rclcpp::PublisherOptionsWithAllocator<AllocatorT> & options)
148148
{
149149
// Topic is unused for now.
150-
(void)topic;
151150
(void)options;
152151

153152
// If needed, setup intra process communication.
@@ -158,11 +157,13 @@ class Publisher : public PublisherBase
158157
// Register the publisher with the intra process manager.
159158
if (qos.history() != rclcpp::HistoryPolicy::KeepLast) {
160159
throw std::invalid_argument(
161-
"intraprocess communication allowed only with keep last history qos policy");
160+
"intraprocess communication on topic '" + topic +
161+
"' allowed only with keep last history qos policy");
162162
}
163163
if (qos.depth() == 0) {
164164
throw std::invalid_argument(
165-
"intraprocess communication is not allowed with a zero qos history depth value");
165+
"intraprocess communication on topic '" + topic +
166+
"' is not allowed with a zero qos history depth value");
166167
}
167168
if (qos.durability() == rclcpp::DurabilityPolicy::TransientLocal) {
168169
buffer_ = rclcpp::experimental::create_intra_process_buffer<

rclcpp/include/rclcpp/subscription.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ class Subscription : public SubscriptionBase
147147
auto qos_profile = get_actual_qos();
148148
if (qos_profile.history() != rclcpp::HistoryPolicy::KeepLast) {
149149
throw std::invalid_argument(
150-
"intraprocess communication allowed only with keep last history qos policy");
150+
"intraprocess communication on topic '" + topic_name +
151+
"' allowed only with keep last history qos policy");
151152
}
152153
if (qos_profile.depth() == 0) {
153154
throw std::invalid_argument(
154-
"intraprocess communication is not allowed with 0 depth qos policy");
155+
"intraprocess communication on topic '" + topic_name +
156+
"' is not allowed with 0 depth qos policy");
155157
}
156158

157159
using SubscriptionIntraProcessT = rclcpp::experimental::SubscriptionIntraProcess<

rclcpp/test/rclcpp/test_publisher.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ TEST_F(TestPublisher, intra_process_publish_failures) {
436436
node->create_publisher<test_msgs::msg::Empty>(
437437
"topic", rclcpp::QoS(0), options),
438438
std::invalid_argument(
439-
"intraprocess communication is not allowed with a zero qos history depth value"));
439+
"intraprocess communication on topic 'topic' "
440+
"is not allowed with a zero qos history depth value"));
440441
}
441442

442443
TEST_F(TestPublisher, inter_process_publish_failures) {

0 commit comments

Comments
 (0)