Skip to content

Commit

Permalink
autopatch: Ensure non-zero retval for missing installer
Browse files Browse the repository at this point in the history
Signed-off-by: Jai Luthra <me@jailuthra.in>
  • Loading branch information
jailuthra committed Nov 9, 2023
1 parent 3b52cbf commit 2f11563
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions win/tools/autopatch/autopatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class MultipleOccurencesException(Exception):
class UnknownPlatformException(Exception):
pass

class InstallerNotFoundException(Exception):
pass

class ExtractedTarget:
name = None
Expand Down Expand Up @@ -229,14 +231,11 @@ def patch_flow(installer_file, search, replacement, target, target_name, patch_n
print(f"Using downloaded file in '{file_path}'")
installer_file = file_path
except (urllib.error.URLError, Exception) as e:
print(f"Failed to download the file: {e}")
return
raise InstallerNotFoundException(f"Failed to download the file: {e}")
except Exception as e:
print(f"An error occurred during download: {str(e)}")
return
raise InstallerNotFoundException(f"An error occurred during download: {str(e)}")
else:
print(f"Invalid installer file or version: {installer_file}")
return
raise InstallerNotFoundException(f"Invalid installer file or version: {installer_file}")

# Rest of the code remains the same...
patch = make_patch(installer_file,
Expand Down

0 comments on commit 2f11563

Please sign in to comment.