Skip to content

Fix download_file silently caching failed HTTP responses#47

Open
importpieter wants to merge 1 commit intofieryhenry:mainfrom
importpieter:fix/game-data-download-error-handling
Open

Fix download_file silently caching failed HTTP responses#47
importpieter wants to merge 1 commit intofieryhenry:mainfrom
importpieter:fix/game-data-download-error-handling

Conversation

@importpieter
Copy link
Copy Markdown

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:

  • Check response.status_code before caching; return None on non-200
  • Handle ConnectionError explicitly with a clear message
  • Fix return type annotation to Optional[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.

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.
@fieryhenry
Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catfruit Error (Matatabi.tsv)

2 participants