-
Notifications
You must be signed in to change notification settings - Fork 159
Improve readability when printing type of classes in error messages #887
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
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: ijnek <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is more user-friendly error message, lgtm with green CI.
Pulls: #887 |
Signed-off-by: ijnek <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 is complaining about double quotes: https://build.ros2.org/job/Rpr__launch__ubuntu_noble_amd64/284/testReport/junit/launch.test/test_flake8/test_flake8/
./launch/utilities/type_utils.py:317:69: Q000 Double quotes found but single quotes preferred
./launch/utilities/type_utils.py:463:66: Q000 Double quotes found but single quotes preferred
Also, I think ci.ros2.org is broken for unrelated reasons: ros2/ros2#1699
Co-authored-by: Christophe Bedard <[email protected]> Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Christophe Bedard <[email protected]> Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Pulls: #887 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, mypy is still complaining 😅
Signed-off-by: ijnek <[email protected]>
Pulls: #887 |
attr_error = AttributeError( | ||
"Attribute '{}' of type '{}' not found in Entity '{}'".format( | ||
name, data_type, self.type_name | ||
name, data_type.__name__, self.type_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not reflected in the type annotation above, but data_type
can be None
apparently here and below :/ see the documentation for this method in the base class:
launch/launch/launch/frontend/entity.py
Line 89 in 6854fae
`data_type = None` will result in yaml parsing of the attribute value as a string. |
- https://ci.ros2.org/job/ci_linux/24014/testReport/junit/test_launch_ros.test.test_launch_ros.frontend/test_component_container/test_launch_component_container_xml/
- https://ci.ros2.org/job/ci_linux/24014/testReport/junit/test_launch_ros.test.test_launch_ros.frontend/test_node_frontend/test_launch_frontend_xml/
I'll open an issue to fix the type annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll open an issue to fix the type annotation.
And unfortunately RHEL fails for a different reason here and in some other places where the variable can be a typing class like
I think it's because it's using an older Python version (3.9) in which typing classes like So this would require some workaround for those locations |
@ijnek do you mind to take a look ? |
Description
In many places, error messages printed types in a verbose format like '<class 'str'>'. This PR simplifies that by displaying just the type name (e.g. 'str').
For example, given this invalid XML:
The previous error output was:
With this change, it becomes:
Did you use Generative AI?
No