From 2f11563e5c565ee7325e84cb990f74a66fa3f38e Mon Sep 17 00:00:00 2001 From: Jai Luthra Date: Thu, 9 Nov 2023 14:13:19 +0530 Subject: [PATCH] autopatch: Ensure non-zero retval for missing installer Signed-off-by: Jai Luthra --- win/tools/autopatch/autopatch.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/win/tools/autopatch/autopatch.py b/win/tools/autopatch/autopatch.py index fb44aee..7426f1b 100755 --- a/win/tools/autopatch/autopatch.py +++ b/win/tools/autopatch/autopatch.py @@ -90,6 +90,8 @@ class MultipleOccurencesException(Exception): class UnknownPlatformException(Exception): pass +class InstallerNotFoundException(Exception): + pass class ExtractedTarget: name = None @@ -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,