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

catch download failures better in init, re: #522 #523

Merged
merged 2 commits into from
Aug 1, 2017
Merged

Conversation

tfoote
Copy link
Member

@tfoote tfoote commented Jul 12, 2017

I think this will provide a better experience and not tell people that this problem is an internal rosdep issue.

@@ -320,9 +321,12 @@ def download_default_sources_list(url=DEFAULT_SOURCES_LIST_URL):
data = f.read().decode()
f.close()
if not data:
raise RuntimeError("cannot download defaults file: empty contents")
raise DownloadFailure("cannot download defaults file: empty contents")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be more helpful if the exception raised would contain the url for which the problem occured.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL added

try:
parse_sources_data(data)
except InvalidData as e:
raise DownloadFailure("Failed to download valid rosdep sources from %s Contents were:{{{%s}}} Parsing error: %s" % (url, data, e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this error has nothing to do with the download but when parsing the data I am not sure this exception type is appropriate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of the available exceptions this looked the most appropriate to me. If there's one you deem more appropriate I'm happy to switch.

Although the error may be unrelated to the actual transport, if the downloaded data is invalid or corrupted the place to look is at the network or source. This is following the same pattern as the exceptions in the function download_rosdep_data where data downloaded failing validation is considered a failed download. And the DownloadFailed exception is the one that makes sense to add urls to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of agree here, since we could conceivably accidentally make malformed sources and then this error would be incorrectly pointing people to problems with their network rather than pointing them at us.

That being said, I think this is unlikely and most of the time it will be due to network errors. So I'm +0 on adding another error for this case.

@dirk-thomas / @tfoote can you guys pick a new error type or make another argument for leaving it as-is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of agree here, since we could conceivably accidentally make malformed sources and then this error would be incorrectly pointing people to problems with their network rather than pointing them at us.

If we are worried about malformed upstream sources, we should add CI in the upstream repo. If it is broken for everyone, people will find the right place to report it even when the error message says its a download failure. I'm +1 on @tfoote's change as is. Or maybe we could rephrase slightly like: "Failed to download and validate rosdep sources from..."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the message to be more explicit about the potential causes.

@tfoote tfoote force-pushed the download_errors branch from 3a8cc86 to 1c66276 Compare July 12, 2017 17:56
@wjwwood
Copy link
Contributor

wjwwood commented Jul 25, 2017

@tfoote do you have time to look at the conflicts on this branch?

@tfoote tfoote force-pushed the download_errors branch from 1c66276 to 0fd102c Compare July 25, 2017 16:34
@tfoote
Copy link
Member Author

tfoote commented Jul 25, 2017

rebased and resolved merge conflict

Copy link
Contributor

@NikolausDemmel NikolausDemmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

try:
parse_sources_data(data)
except InvalidData as e:
raise DownloadFailure("Failed to download valid rosdep sources from %s Contents were:{{{%s}}} Parsing error: %s" % (url, data, e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of agree here, since we could conceivably accidentally make malformed sources and then this error would be incorrectly pointing people to problems with their network rather than pointing them at us.

If we are worried about malformed upstream sources, we should add CI in the upstream repo. If it is broken for everyone, people will find the right place to report it even when the error message says its a download failure. I'm +1 on @tfoote's change as is. Or maybe we could rephrase slightly like: "Failed to download and validate rosdep sources from..."

@wjwwood wjwwood merged commit 27d372b into master Aug 1, 2017
@wjwwood wjwwood deleted the download_errors branch August 1, 2017 21:54
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.

4 participants