Move new exception catching for metadata errors

This commit is contained in:
Jim Miller 2024-03-05 08:04:22 -06:00
parent 7263f4120c
commit f21f039b3a
2 changed files with 40 additions and 40 deletions

View file

@ -15,7 +15,6 @@ logger = logging.getLogger(__name__)
from datetime import datetime from datetime import datetime
import traceback, sys
from PyQt5 import QtWidgets as QtGui from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore from PyQt5 import QtCore
@ -38,7 +37,6 @@ except:
from calibre.gui2 import gprefs from calibre.gui2 import gprefs
show_download_options = 'fff:add new/update dialogs:show_download_options' show_download_options = 'fff:add new/update dialogs:show_download_options'
from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.dialogs.confirm_delete import confirm
from calibre.gui2 import error_dialog
from calibre.gui2.complete2 import EditWithComplete from calibre.gui2.complete2 import EditWithComplete
from fanficfare.six import text_type as unicode, ensure_text from fanficfare.six import text_type as unicode, ensure_text
@ -726,12 +724,6 @@ class _LoopProgressDialog(QProgressDialog):
book['status']=_("Error") book['status']=_("Error")
book['comment']=unicode(e) book['comment']=unicode(e)
logger.error("Exception: %s:%s"%(book,book['comment']),exc_info=True) logger.error("Exception: %s:%s"%(book,book['comment']),exc_info=True)
det_msg = "".join(traceback.format_exception(*sys.exc_info())) # +"\n"+_("Story Details:")+pretty_book(book)
error_dialog(self.gui,
_("Error Updating Metadata"),
"<p>"+_("An error has occurred while FanFicFare was updating calibre's metadata for <a href='%s'>%s</a>.")%(book['url'],book['title'])+"</p>",
det_msg=det_msg,
show=True)
self.updateStatus() self.updateStatus()
self.i += 1 self.i += 1

View file

@ -1797,7 +1797,7 @@ class FanFicFarePlugin(InterfaceAction):
'bgmeta':False}, 'bgmeta':False},
errorcol_label=None, errorcol_label=None,
lastcheckedcol_label=None): lastcheckedcol_label=None):
try:
if options.get('add_tag',False): if options.get('add_tag',False):
book['tags'].extend(options.get('add_tag').split(',')) book['tags'].extend(options.get('add_tag').split(','))
@ -1834,6 +1834,14 @@ class FanFicFarePlugin(InterfaceAction):
("<p><b>"+_("FanFicFare will try to update metadata again once. Close any interfering programs (such as Windows File Explorer) before closing this dialog.")+"</b></p>" if first else ""), ("<p><b>"+_("FanFicFare will try to update metadata again once. Close any interfering programs (such as Windows File Explorer) before closing this dialog.")+"</b></p>" if first else ""),
det_msg=det_msg, det_msg=det_msg,
show=True) show=True)
except Exception as e:
logger.error("Exception: %s:%s"%(book,book['comment']),exc_info=True)
det_msg = "".join(traceback.format_exception(*sys.exc_info())) # +"\n"+_("Story Details:")+pretty_book(book)
error_dialog(self.gui,
_("Error Updating Metadata"),
"<p>"+_("An error has occurred while FanFicFare was updating calibre's metadata for <a href='%s'>%s</a>.")%(book['url'],book['title'])+"</p>",
det_msg=det_msg,
show=True)
def update_books_finish(self, book_list, options={}, showlist=True): def update_books_finish(self, book_list, options={}, showlist=True):
'''Notify calibre about updated rows, update external plugins '''Notify calibre about updated rows, update external plugins