From af819c216fb8088645d06db29f50bcb25cc33a2b Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 30 Jan 2021 17:37:05 +0530 Subject: [PATCH] [postprocessor] Raise errors correctly Previously, when a postprocessor reported error, the download was still considered a success. This causes issues especially with critical PPs like Merger, MoveFiles etc :ci skip dl --- youtube_dlc/YoutubeDL.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 62f702356..8aa0b7fbd 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -2145,8 +2145,8 @@ def dl(name, info, subtitle=False): else: try: self.post_process(full_filename, info_dict, files_to_move) - except (PostProcessingError) as err: - self.report_error('postprocessing: %s' % str(err)) + except PostProcessingError as err: + self.report_error('Postprocessing: %s' % str(err)) return if self.params.get('writeinfojson', False): @@ -2394,8 +2394,8 @@ def correct_ext(filename): try: self.post_process(dl_filename, info_dict, files_to_move) - except (PostProcessingError) as err: - self.report_error('postprocessing: %s' % str(err)) + except PostProcessingError as err: + self.report_error('Postprocessing: %s' % str(err)) return try: for ph in self._post_hooks: @@ -2467,10 +2467,7 @@ def filter_requested_info(info_dict): def run_pp(self, pp, infodict, files_to_move={}): files_to_delete = [] - try: - files_to_delete, infodict = pp.run(infodict) - except PostProcessingError as e: - self.report_error(e.msg) + files_to_delete, infodict = pp.run(infodict) if not files_to_delete: return files_to_move, infodict