Skip to content

Formatting error when printing badly formatted messages #1159

@DarrenBookless

Description

@DarrenBookless

Description
I'm trying to debug some code which (on my end) is currently sending a badly formatted JSON message to the ROSBridge server. Naturally, the rosbridge server prints an error in response to this:

[rosbridge_websocket]: [Client 3f20257e-00de-480c-8438-ed6579be69ad] Received a message without an op. All messages require 'op' field with value one of: ['advertise', 'unadvertise', 'publish', 'subscribe', 'unsubscribe', 'fragment', 'advertise_service', 'call_service', 'service_response', 'unadvertise_service', 'advertise_action', 'action_feedback', 'action_result', 'send_action_goal', 'cancel_action_goal', 'unadvertise_action']. Original message was: {message_string}

Two problems with this:

  • This isn't an accurate description of my problem - my message is actually just missing its back half and so doesn't close all of its "{"/"}" pairs
  • As you can see, rather than printing the malformed message, it just says "Original message was: {message_string}"

From local testing, the problem is just a missing "f" from what should be an f-string here:

"Original message was: {message_string}",

  • Library Version: (unsure how to check this, but current at the time of writing!)
  • ROS Version: Humble
  • Platform / OS: Ubuntu 24.04

Steps To Reproduce
Send a malformed json message to the rosbridge server.

Expected Behavior
Error message identifies cause of error and prints the malformed message.

Actual Behavior
Prints the literal text "{message_string}" without variable substitution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions