Handle network errors gracefully during downloads#416
Open
Rani367 wants to merge 1 commit intoAsahiLinux:mainfrom
Open
Handle network errors gracefully during downloads#416Rani367 wants to merge 1 commit intoAsahiLinux:mainfrom
Rani367 wants to merge 1 commit intoAsahiLinux:mainfrom
Conversation
When internet connectivity is lost during downloads, the installer now catches network exceptions and shows user-friendly error messages with recovery guidance instead of crashing with a Python traceback. - Add NetworkError exception class to urlcache.py - Add retry logic to get_size() which previously had none (5 retries with backoff) - Raise NetworkError from get_block() after retries exhausted instead of re-raising raw exceptions - Wrap pre-partition download calls with interactive retry prompts (safe to retry since no disk state has changed) - Wrap post-partition do_install() calls with clean exit and repair guidance (tells user to re-run installer to trigger repair flow) - Add NetworkError handler to action_rebuild_vendorfw - Add NetworkError safety net in global exception handler Closes AsahiLinux#409 Signed-off-by: Rani367 <rani2011367@gmail.com>
049c8c9 to
f09f031
Compare
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.
Summary
Closes #409.
When internet connectivity is lost during downloads, the installer crashes with a raw Python traceback. This patch catches network exceptions and shows actionable error messages with recovery guidance instead.
Changes in
urlcache.py:NetworkErrorexception classget_size(), which previously had no retries at all (network errors during the initial HEAD request would crash immediately)get_block()now raisesNetworkErrorafter retries are exhausted instead of re-raising the raw exceptionChanges in
main.py:load_ipsw,load_package) with interactive retry prompts, since no disk changes have been made at that point and retrying is safedo_install()calls with a clean exit message that tells the user to re-run the installer for automatic repairNetworkErrorhandler toaction_rebuild_vendorfwNetworkErrorcatch in the global exception handler as a safety netBefore (raw traceback, no guidance):
After:
Pre-partition failure (interactive retry):
Post-partition failure (clean exit with repair guidance):
Test plan
NetworkErrorclass imports correctly and is a properExceptionsubclassget_size()retries 5 times with backoff on connection failure, then raisesNetworkErrorget_block()retries 10 times (unchanged), then raisesNetworkErrorinstead of raw exceptionfrom e) preserves original traceback in logspy_compilesyntax check