From 6c0122648a1156f589191eda52f60a0daabe98a4 Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Thu, 31 Dec 2020 12:21:13 -0800 Subject: [PATCH] Changed return to sys.exit in python script to show error --- .github/scripts/icomoon_build.py | 11 ++++++----- .github/scripts/icomoon_peek.py | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/scripts/icomoon_build.py b/.github/scripts/icomoon_build.py index da8f0236..545042af 100644 --- a/.github/scripts/icomoon_build.py +++ b/.github/scripts/icomoon_build.py @@ -1,4 +1,5 @@ from pathlib import Path +import sys from selenium.common.exceptions import TimeoutException # pycharm complains that build_assets is an unresolved ref @@ -11,8 +12,7 @@ def main(): args = arg_getters.get_selenium_runner_args() new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path) if len(new_icons) == 0: - print("No files need to be uploaded. Ending script...") - return + sys.exit("No files need to be uploaded. Ending script...") # print list of new icons print("List of new icons:", *new_icons, sep = "\n") @@ -32,10 +32,11 @@ def main(): filehandler.rename_extracted_files(args.download_path) print("Task completed.") except TimeoutException as e: - print(e) - print(e.stacktrace) + sys.exit("Selenium Time Out Error: \n" + e) + except Exception as e: + sys.exit(e) finally: - runner.close() + runner.close() if __name__ == "__main__": diff --git a/.github/scripts/icomoon_peek.py b/.github/scripts/icomoon_peek.py index c5be4acf..2ef39f51 100644 --- a/.github/scripts/icomoon_peek.py +++ b/.github/scripts/icomoon_peek.py @@ -38,11 +38,11 @@ def main(): runner.upload_svgs(svgs, screenshot_folder) print("Task completed.") except TimeoutException as e: - print("Selenium Time Out Error: ", e.stacktrace, sep='\n') + sys.exit("Selenium Time Out Error: \n" + e) except Exception as e: - print(e) + sys.exit(e) finally: - runner.close() + runner.close() def find_object_added_in_this_pr(icons: List[dict], pr_title: str):