Improve download error failures#36
Open
ehennestad wants to merge 2 commits intomainfrom
Open
Conversation
Added versions.json to gitignore
Comment on lines
+24
to
+25
| class DownloadError(RuntimeError): | ||
| pass |
Member
There was a problem hiding this comment.
We could improve this by adding an init method that accepts url and path as part of the exception, instead of passing and handling them separately throughout the code.
Comment on lines
+58
to
+63
| def _format_download_error(url, path, error): | ||
| if isinstance(error, urllib.error.URLError) and isinstance(error.reason, ssl.SSLCertVerificationError): | ||
| reason = "SSL certificate verification failed. Check your local Python certificate store." | ||
| else: | ||
| reason = str(error) | ||
| return f'Failed to download "{url}" to "{path}": {reason}' |
Member
There was a problem hiding this comment.
We could move "_format_download_error" into DownloadError as a @classmethod, and rename it to something like from_exception, since its responsibility is focused only on producing a clear error message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
versions.jsonand related metadata downloads failDownloadErrorinstead of falling through to a laterFileNotFoundErrorversions.jsonto.gitignoreso the downloaded file is not tracked accidentallyWhy
When the validator could not download
versions.json, it logged a network error and then continued into a confusingFileNotFoundErrorbecause the file was never created.Impact
Validation failures caused by download problems should now be easier to understand and diagnose, especially for local SSL certificate issues.
Validation
openMINDS_validation/utils.pysuccessfully withast.parse