From ac22483f9841966fa7a23fe196ee5925d201e827 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sun, 23 Aug 2020 21:35:05 -0400 Subject: [PATCH] Add error handling to the email task within the convert task --- cps/tasks/convert.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cps/tasks/convert.py b/cps/tasks/convert.py index 2b6c6db4..381ae6b8 100644 --- a/cps/tasks/convert.py +++ b/cps/tasks/convert.py @@ -32,17 +32,20 @@ class TaskConvert(CalibreTask): def run(self, worker_thread): self.worker_thread = worker_thread filename = self._convert_ebook_format() - # todo: re-enable this (need to set up gdrive to test with) + if filename: if config.config_use_google_drive: gdriveutils.updateGdriveCalibreFromLocal() if self.kindle_mail: # if we're sending to kindle after converting, create a one-off task and run it immediately # todo: figure out how to incorporate this into the progress - task = TaskEmail(self.settings['subject'], self.results["path"], + try: + task = TaskEmail(self.settings['subject'], self.results["path"], filename, self.settings, self.kindle_mail, self.settings['subject'], self.settings['body'], internal=True) - task.start() + task.start() + except Exception as e: + return self._handleError(str(e)) self._handleSuccess() pass