Use git tags when GitHub API returns an empty list of releases #681
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.
Ongoing GitHub API issues appear to have revealed a potential script bug in
mongosh_dl.pywhere a call to_get_latest_version()may returnNone, e.g.:The only way I see
_get_latest_version()can returnNone(when not taking the_get_latest_version_git()branch) is if thefor item in dataloop falls-through to the end of the function. I do not know what the response could be such that the API request succeeds (otherwiseurllib.request.urlopen()should raise anURLError) and returns valid JSON (otherwisejson.loads()should raise anJSONDecodeError), yet the contents do not contain any array element with atag_name(or possibly does not contain any array elements at all...?). Therefore, this PR proposes printing the contents ofdataon error to assist with debugging this condition if it occurs again + raising an exception to fail-early when notag_nameis found (avoid attempting to download+cache an invalid URL).