-
Notifications
You must be signed in to change notification settings - Fork 146
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
Improve error reporting by adding file locations to exceptions #823
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: Roland Arsenault <[email protected]>
Signed-off-by: Roland Arsenault <[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.
Thanks for the PR. Could you add simple before/after example outputs in the PR description (including the commands you ran to get the output, if possible) to show how this improves error reporting?
declared_launch_arguments = ( | ||
launch_description.get_launch_arguments_with_include_launch_description_actions()) | ||
except Exception as exc: | ||
exc.add_note('while executing {}'.format(self.describe())) |
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.
Could you switch to f-strings, here and everywhere else?
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.
Python is not my native programming language so I had to google f-strings and learned something useful. Thanks!
Example output using https://github.com/rolker/launch_error_examples This is a simpler set of launch files than what I was dealing with when I created the patch, but still has some nested includes to better showcase the issue when dealing with complex launch files. It should be noted that this helps with error that pop up when the launch description is executed. Errors while loading/evaluating the files tend to display the file location of the error. Before the patch:
With this patch applied. Notice the added info where the exception is printed with the added notes.
|
Signed-off-by: Roland Arsenault <[email protected]>
In order to pinpoint which launch file caused an exception, this patch intercepts exceptions and adds notes that help determine the source of the error.
This might help with #799 as well.