mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 09:46:25 +00:00
Tweaked error reporting (close #109)
This commit is contained in:
@@ -365,6 +365,12 @@ class WorkerThread(QtCore.QThread):
|
||||
MW.progressBarTick.emit('tick')
|
||||
self.workerOutput.append(output)
|
||||
|
||||
def sanitizeTrace(self, traceback):
|
||||
return ''.join(format_tb(traceback))\
|
||||
.replace('C:\\Users\\AcidWeb\\Documents\\Projekty\\KCC\\', '')\
|
||||
.replace('C:\\Python34\\', '')\
|
||||
.replace('C:\\Python34_64\\', '')
|
||||
|
||||
def run(self):
|
||||
MW.modeConvert.emit(0)
|
||||
|
||||
@@ -462,7 +468,7 @@ class WorkerThread(QtCore.QThread):
|
||||
self.errors = True
|
||||
_, _, traceback = sys.exc_info()
|
||||
MW.showDialog.emit("Error during conversion %s:\n\n%s\n\nTraceback:\n%s"
|
||||
% (jobargv[-1], str(err), "".join(format_tb(traceback))), 'error')
|
||||
% (jobargv[-1], str(err), self.sanitizeTrace(traceback)), 'error')
|
||||
MW.addMessage.emit('Failed to create EPUB!', 'error', False)
|
||||
MW.addTrayMessage.emit('Failed to create EPUB!', 'Critical')
|
||||
if not self.conversionAlive:
|
||||
|
||||
@@ -871,7 +871,7 @@ def detectCorruption(tmpPath, orgPath):
|
||||
for name in files:
|
||||
if getImageFileName(name) is not None:
|
||||
path = os.path.join(root, name)
|
||||
pathOrg = os.path.join(orgPath, name)
|
||||
pathOrg = orgPath + path.split('OEBPS' + os.path.sep + 'Images')[1]
|
||||
if os.path.getsize(path) == 0:
|
||||
rmtree(os.path.join(tmpPath, '..', '..'), True)
|
||||
raise RuntimeError('Image file %s is corrupted.' % pathOrg)
|
||||
|
||||
Reference in New Issue
Block a user