1
0
mirror of https://github.com/konpa/devicon.git synced 2025-02-24 09:12:36 +01:00

Changed return to sys.exit in python script to show error

This commit is contained in:
Thomas Bui 2020-12-31 12:21:13 -08:00
parent fce491e4ce
commit 6c0122648a
2 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,5 @@
from pathlib import Path from pathlib import Path
import sys
from selenium.common.exceptions import TimeoutException from selenium.common.exceptions import TimeoutException
# pycharm complains that build_assets is an unresolved ref # pycharm complains that build_assets is an unresolved ref
@ -11,8 +12,7 @@ def main():
args = arg_getters.get_selenium_runner_args() args = arg_getters.get_selenium_runner_args()
new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path) new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path)
if len(new_icons) == 0: if len(new_icons) == 0:
print("No files need to be uploaded. Ending script...") sys.exit("No files need to be uploaded. Ending script...")
return
# print list of new icons # print list of new icons
print("List of new icons:", *new_icons, sep = "\n") print("List of new icons:", *new_icons, sep = "\n")
@ -32,10 +32,11 @@ def main():
filehandler.rename_extracted_files(args.download_path) filehandler.rename_extracted_files(args.download_path)
print("Task completed.") print("Task completed.")
except TimeoutException as e: except TimeoutException as e:
print(e) sys.exit("Selenium Time Out Error: \n" + e)
print(e.stacktrace) except Exception as e:
sys.exit(e)
finally: finally:
runner.close() runner.close()
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -38,11 +38,11 @@ def main():
runner.upload_svgs(svgs, screenshot_folder) runner.upload_svgs(svgs, screenshot_folder)
print("Task completed.") print("Task completed.")
except TimeoutException as e: 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: except Exception as e:
print(e) sys.exit(e)
finally: finally:
runner.close() runner.close()
def find_object_added_in_this_pr(icons: List[dict], pr_title: str): def find_object_added_in_this_pr(icons: List[dict], pr_title: str):