Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use clearer error message when publishing without first advertising #163

Conversation

christophebedard
Copy link
Contributor

I'm new to ros2-web-bridge and its protocol, so it took me some time to understand that this is what happens when you try to publish without first advertising the topic and its type:

ros2-web-bridge:Bridge JSON command received: {"op":"publish","id":"publish:/example_topic2:1","topic":"/example_topic2","msg":{"data":"hello"},"latch":false} +11s
  ros2-web-bridge:Bridge Publish a topic named /example_topic2 with {"data":"hello"} +0ms
  ros2-web-bridge:Bridge Response: {"op":"status","level":"error","msg":"publish: TypeError: Cannot read property 'get' of undefined","id":"publish:/example_topic2:1"} +1ms

This PR adds a clearer error message (similar to what the other ops have):

  ros2-web-bridge:Bridge JSON command received: {"op":"publish","id":"publish:/example_topic2:1","topic":"/example_topic2","msg":{"data":"hello"},"latch":false} +2s
  ros2-web-bridge:Bridge Publish a topic named /example_topic2 with {"data":"hello"} +1ms
  ros2-web-bridge:Bridge Response: {"op":"status","level":"error","msg":"publish: Error: The topic /example_topic2 does not exist","id":"publish:/example_topic2:1"} +1ms

Copy link
Member

@minggangw minggangw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, lgtm!

@minggangw minggangw merged commit c912bc4 into RobotWebTools:develop Jan 6, 2021
@christophebedard christophebedard deleted the provide-clear-message-publish-without-advertise branch January 6, 2021 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants