Skip to content

Commit

Permalink
ensenso_camera: scripts: Fix error formatting
Browse files Browse the repository at this point in the history
Broken in 9db1b00.
  • Loading branch information
benthie committed Dec 22, 2023
1 parent 741de55 commit e4b1cc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 7 additions & 0 deletions ensenso_camera/src/ensenso_camera/ros2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def is_ros2():
return os.environ["ROS_VERSION"] == "2"


def format_error(error, note=None):
msg = "Error {}: {}".format(error.code, error.message)
if note:
msg = "{} ({})".format(note.strip(), msg)
return msg


# ----------------------------------------------------------------------------------------------------------------------
# ROS2
# ----------------------------------------------------------------------------------------------------------------------
Expand Down
9 changes: 1 addition & 8 deletions ensenso_camera_test/src/ensenso_camera_test/fit_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ def get_plane_fit_primitive():
return primitive


def format_error(error, note=None):
msg = "Error {}: {}".format(error.code, error.message)
if note:
msg = "{} ({})".format(note.strip(), msg)
return msg


# Exact values of objects in the test scene
class SphereTestValues:
def __init__(self):
Expand Down Expand Up @@ -140,7 +133,7 @@ def get_result(self, goal):
response = ros2py.send_action_goal(self.node, self.fit_primitive_client, goal)
self.assertTrue(response.successful(), msg="Fit primitive action has not been successful.")
error = response.get_result().error
self.assertEqual(error.code, 0, msg=format_error(error, note="Fit primitive action exited with error!"))
self.assertEqual(error.code, 0, msg=ros2py.format_error(error, note="Fit primitive action exited with error!"))
return response.get_result()


Expand Down

0 comments on commit e4b1cc4

Please sign in to comment.