[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
This commit is contained in:
pukkandan 2021-01-30 17:37:05 +05:30
parent e3b771a898
commit af819c216f

View File

@ -2145,8 +2145,8 @@ class YoutubeDL(object):
else: else:
try: try:
self.post_process(full_filename, info_dict, files_to_move) self.post_process(full_filename, info_dict, files_to_move)
except (PostProcessingError) as err: except PostProcessingError as err:
self.report_error('postprocessing: %s' % str(err)) self.report_error('Postprocessing: %s' % str(err))
return return
if self.params.get('writeinfojson', False): if self.params.get('writeinfojson', False):
@ -2394,8 +2394,8 @@ class YoutubeDL(object):
try: try:
self.post_process(dl_filename, info_dict, files_to_move) self.post_process(dl_filename, info_dict, files_to_move)
except (PostProcessingError) as err: except PostProcessingError as err:
self.report_error('postprocessing: %s' % str(err)) self.report_error('Postprocessing: %s' % str(err))
return return
try: try:
for ph in self._post_hooks: for ph in self._post_hooks:
@ -2467,10 +2467,7 @@ class YoutubeDL(object):
def run_pp(self, pp, infodict, files_to_move={}): def run_pp(self, pp, infodict, files_to_move={}):
files_to_delete = [] files_to_delete = []
try: files_to_delete, infodict = pp.run(infodict)
files_to_delete, infodict = pp.run(infodict)
except PostProcessingError as e:
self.report_error(e.msg)
if not files_to_delete: if not files_to_delete:
return files_to_move, infodict return files_to_move, infodict