From 0ebd793d614b668cc9cd39e9f86ce41ea56eb715 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Sep 2014 23:51:37 +0530 Subject: [PATCH] Nicer error message when a book being converted is deleted from the library --- src/calibre/gui2/actions/convert.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/convert.py b/src/calibre/gui2/actions/convert.py index 20daaed007..2fd556fe44 100644 --- a/src/calibre/gui2/actions/convert.py +++ b/src/calibre/gui2/actions/convert.py @@ -246,6 +246,10 @@ class ConvertAction(InterfaceAction): if job.failed: self.gui.job_exception(job) return + db = self.gui.current_db + if not db.new_api.has_id(book_id): + return error_dialog(self.gui, _('Book deleted'), _( + 'The book you were trying to convert has been deleted from the calibre library.'), show=True) same_fmt = getattr(job, 'conversion_of_same_fmt', False) manually_fine_tune_toc = getattr(job, 'manually_fine_tune_toc', False) fmtf = temp_files[-1].name @@ -253,7 +257,6 @@ class ConvertAction(InterfaceAction): raise Exception(_('Empty output file, ' 'probably the conversion process crashed')) - db = self.gui.current_db if same_fmt and tweaks['save_original_format']: db.save_original_format(book_id, fmt, notify=False)