1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-05 01:26:21 +00:00

Fail the convert task if the email subtask fails

This commit is contained in:
blitzmann 2020-08-24 21:28:55 -04:00
parent 5ec1283bb1
commit f3a3797850

View File

@ -8,7 +8,7 @@ from shutil import copyfile
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
from cps.services.worker import CalibreTask from cps.services.worker import CalibreTask, STAT_FINISH_SUCCESS
from cps import calibre_db, db from cps import calibre_db, db
from cps import logger, config from cps import logger, config
from cps.subproc_wrapper import process_open from cps.subproc_wrapper import process_open
@ -43,7 +43,11 @@ class TaskConvert(CalibreTask):
task = TaskEmail(self.settings['subject'], self.results["path"], task = TaskEmail(self.settings['subject'], self.results["path"],
filename, self.settings, self.kindle_mail, filename, self.settings, self.kindle_mail,
self.settings['subject'], self.settings['body'], internal=True) self.settings['subject'], self.settings['body'], internal=True)
task.start() task.start(worker_thread)
# even though the convert task might be finished, if this task fails, fail the whole thing
if task.stat != STAT_FINISH_SUCCESS:
raise Exception(task.error)
except Exception as e: except Exception as e:
return self._handleError(str(e)) return self._handleError(str(e))