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

[roslaunch] Better exception handling when resource is not found. #1476

Merged

Conversation

130s
Copy link
Member

@130s 130s commented Aug 9, 2018

When $(find pkg) fail to return a resource in arg tag, roslaunch fails without printing useful output. With this PR it provides better explanation.

Though I haven't looked into whether there's a test that covers this yet, I'm happy to add one if needed.

Without this PR:

$ roslaunch /tmp/invalid_arg.launch
:
Invalid <arg> tag: foo
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/n130s/ROS/indigo_trusty/cws_rosdt/src/ros/ros_comm/tools/roslaunch
ROS path [2]=/opt/ros/kinetic/share

Arg xml is <arg default="$(find foo)/.config" name="foo"/>
The traceback for the exception was written to the log file

With this PR:

$ roslaunch /tmp/invalid_arg.launch
:
Invalid <arg> tag: Make sure the following is found in ROS_PACKAGE_PATH: foo
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/n130s/ROS/indigo_trusty/cws_rosdt/src/ros/ros_comm/tools/roslaunch
ROS path [2]=/opt/ros/kinetic/share

Arg xml is <arg default="$(find foo)/.config" name="foo"/>
The traceback for the exception was written to the log file
$ more /tmp/invalid_arg.launch
<?xml version="1.0"?>
<launch>
  <arg name="foo" default="$(find foo)/.config" />
  <arg name="baa" default="$(arg foo)/hoge.yaml" />
</launch>

130s added 2 commits August 10, 2018 05:35
When `$(find pkg)` fail to return a resource in `arg` tag, `roslaunch` fails without printing useful output. With this PR it provides better explanation.

Without this PR:
```
$ roslaunch /tmp/invalid_arg.launch
:
Invalid <arg> tag: foo
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/n130s/ROS/indigo_trusty/cws_rosdt/src/ros/ros_comm/tools/roslaunch
ROS path [2]=/opt/ros/kinetic/share

Arg xml is <arg default="$(find foo)/.config" name="foo"/>
The traceback for the exception was written to the log file
```

With this PR:
```
$ roslaunch /tmp/invalid_arg.launch
:
Invalid <arg> tag: Make sure the following is found in ROS_PACKAGE_PATH: foo
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/n130s/ROS/indigo_trusty/cws_rosdt/src/ros/ros_comm/tools/roslaunch
ROS path [2]=/opt/ros/kinetic/share

Arg xml is <arg default="$(find foo)/.config" name="foo"/>
The traceback for the exception was written to the log file
```

```
$ more /tmp/invalid_arg.launch
<?xml version="1.0"?>
<launch>
  <arg name="foo" default="$(find foo)/.config" />
  <arg name="baa" default="$(arg foo)/hoge.yaml" />
</launch>
```
@130s 130s force-pushed the impr_invalid_arg_err/melodic-devel branch from 93ddea2 to 9aaf108 Compare August 10, 2018 13:09
@130s
Copy link
Member Author

130s commented Aug 10, 2018

Output with the updated commit :

$ roslaunch /tmp/invalid_arg.launch
... logging to /home/n130s/.ros/log/0cae8616-9c9f-11e8-9714-c85b766a6139/roslaunch-130s-p50-23667.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Resource not found: Tag the exception occurred at <arg default="$(find foo)/.config" name="foo"/>
Package not found in ROS_PACKAGE_PATH: foo
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/n130s/cws_rosdt/install/share
ROS path [2]=/home/n130s/cws_rosdt/src/ros/ros_comm/tools/roslaunch
ROS path [3]=/opt/ros/kinetic/share
Make sure the package is found in ROS_PACKAGE_PATH.
The traceback for the exception was written to the log file

@130s
Copy link
Member Author

130s commented Aug 16, 2018

@ros-pull-request-builder retest this please

@dirk-thomas
Copy link
Member

@130s I hope the shorter message is fine with you: 9b3f5e3

@dirk-thomas dirk-thomas merged commit a8d54b2 into ros:melodic-devel Aug 28, 2018
@dirk-thomas
Copy link
Member

Thank you for the improvement.

@130s 130s deleted the impr_invalid_arg_err/melodic-devel branch August 31, 2018 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants