From 9e3f3d783007e48b1fd98f7021ec5e6e50ac1d42 Mon Sep 17 00:00:00 2001 From: iaacornus Date: Mon, 6 Jun 2022 18:31:41 +0800 Subject: [PATCH] improved exception handling --- video_creation/final_video.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 7b1ed02..e6fa7da 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -13,14 +13,13 @@ from moviepy.editor import ( ) import reddit.subreddit -from utils.console import print_step +from utils.console import print_step, print_substep W, H = 1080, 1920 def make_final_video(number_of_clips, file_name): - # Calls opacity from the .env load_dotenv() opacity = os.getenv("OPACITY") @@ -57,10 +56,11 @@ def make_final_video(number_of_clips, file_name): OSError, FileNotFoundError, ): - ... - - audio_concat = concatenate_audioclips(audio_clips) - audio_composite = CompositeAudioClip([audio_concat]) + print_substep("An error occured! Aborting.", style="bold red") + raise SystemExit() + else: + audio_concat = concatenate_audioclips(audio_clips) + audio_composite = CompositeAudioClip([audio_concat]) # Gather all images image_clips = []