Use the logException function in all places where exception messages are written to the error log

This commit is contained in:
Veronica K. B. Olsen
2021-01-29 18:29:50 +01:00
parent a2f223a992
commit 89ba4aeeaf
11 changed files with 72 additions and 63 deletions
+6 -6
View File
@@ -671,9 +671,9 @@ class GuiBuildNovel(QDialog):
bldObj.doConvert()
bldObj.doPostProcessing()
except Exception as e:
except Exception:
logger.error("Failed to generate html of document '%s'" % tItem.itemHandle)
logger.error(str(e))
nw.logException()
if isPreview:
self.docView.setText((
"Failed to generate preview. "
@@ -997,9 +997,9 @@ class GuiBuildNovel(QDialog):
with open(buildCache, mode="r", encoding="utf8") as inFile:
theJson = inFile.read()
theData = json.loads(theJson)
except Exception as e:
except Exception:
logger.error("Failed to load build cache")
logger.error(str(e))
nw.logException()
return False
if "htmlText" in theData.keys():
@@ -1026,9 +1026,9 @@ class GuiBuildNovel(QDialog):
"htmlStyle" : self.htmlStyle,
"buildTime" : self.buildTime,
}, indent=2))
except Exception as e:
except Exception:
logger.error("Failed to save build cache")
logger.error(str(e))
nw.logException()
return False
return True
+2 -2
View File
@@ -180,9 +180,9 @@ class GuiDocViewer(QTextBrowser):
aDoc.tokenizeText()
aDoc.doConvert()
aDoc.doPostProcessing()
except Exception as e:
except Exception:
logger.error("Failed to generate preview for document with handle '%s'" % tHandle)
logger.error(str(e))
nw.logException()
self.setText("An error occurred while generating the preview.")
return False
+8 -8
View File
@@ -265,9 +265,9 @@ class GuiTheme:
if os.path.isfile(self.cssFile):
with open(self.cssFile, mode="r", encoding="utf8") as inFile:
cssData = inFile.read()
except Exception as e:
except Exception:
logger.error("Could not load theme css file")
logger.error(str(e))
nw.logException()
return False
# Config File
@@ -275,9 +275,9 @@ class GuiTheme:
try:
with open(self.confFile, mode="r", encoding="utf8") as inFile:
confParser.read_file(inFile)
except Exception as e:
except Exception:
logger.error("Could not load theme settings from: %s" % self.confFile)
logger.error(str(e))
nw.logException()
return False
## Main
@@ -333,9 +333,9 @@ class GuiTheme:
try:
with open(self.syntaxFile, mode="r", encoding="utf8") as inFile:
confParser.read_file(inFile)
except Exception as e:
except Exception:
logger.error("Could not load syntax colours from: %s" % self.syntaxFile)
logger.error(str(e))
nw.logException()
return False
## Main
@@ -637,9 +637,9 @@ class GuiIcons:
try:
with open(self.confFile, mode="r", encoding="utf8") as inFile:
confParser.read_file(inFile)
except Exception as e:
except Exception:
logger.error("Could not load icon theme settings from: %s" % self.confFile)
logger.error(str(e))
nw.logException()
return False
## Main