Fix download_file silently caching failed HTTP responses#47
Open
importpieter wants to merge 1 commit intofieryhenry:mainfrom
Open
Fix download_file silently caching failed HTTP responses#47importpieter wants to merge 1 commit intofieryhenry:mainfrom
importpieter wants to merge 1 commit intofieryhenry:mainfrom
Conversation
If the BCData repo doesn't have a file for the current game version, requests.get() returns a 404 with HTML content. The old code wrote this to disk and cached it, so subsequent runs would read corrupt data without any useful error message. Now check the status code before caching and return None on failure, letting callers surface a meaningful error. Also handle ConnectionError explicitly with a clear message instead of raising an unhandled exception.
Owner
|
Your branch is 878 commits behind, that file doesn't exist anymore since the whole editor has been re-written since. The new system shouldn't have these issues, but if it does, please make sure to make your changes to the current version of the editor. Also preferably open the pull request on codeberg since this GitHub repo is just a mirror: https://codeberg.org/fieryhenry/BCSFE-Python |
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.
Fixes #43 and #45.
When the BCData repo doesn't have a file for the current game version,
requests.get()returns a 404 with HTML content. The old code wrote this to disk and cached it — so subsequent runs would read corrupt data with no useful error message, making the problem look like a network issue.Changes:
response.status_codebefore caching; returnNoneon non-200ConnectionErrorexplicitly with a clear messageOptional[bytes]Users hitting the drop_chara.csv / Matatabi.tsv errors will now get a clear message explaining the file isn't available for their game version, rather than a confusing network error.