diff --git a/novelwriter/core/coretools.py b/novelwriter/core/coretools.py
index 094c8c55..379e050f 100644
--- a/novelwriter/core/coretools.py
+++ b/novelwriter/core/coretools.py
@@ -480,7 +480,7 @@ class ProjectBuilder:
except Exception as exc:
self.mainGui.makeAlert(self.tr(
"Failed to create a new example project."
- ), level=nwAlert.ERROR, exception=exc)
+ ), level=nwAlert.ERROR, exc=exc)
return False
else:
diff --git a/novelwriter/core/project.py b/novelwriter/core/project.py
index c1b2ea2a..b4bc16bf 100644
--- a/novelwriter/core/project.py
+++ b/novelwriter/core/project.py
@@ -376,7 +376,7 @@ class NWProject(QObject):
if not xmlWriter.write(self._data, content, saveTime, editTime):
self.mainGui.makeAlert(self.tr(
"Failed to save project."
- ), level=nwAlert.ERROR, exception=xmlWriter.error)
+ ), level=nwAlert.ERROR, exc=xmlWriter.error)
return False
# Save other project data
@@ -430,7 +430,7 @@ class NWProject(QObject):
except Exception as exc:
self.mainGui.makeAlert(self.tr(
"Could not create backup folder."
- ), level=nwAlert.ERROR, exception=exc)
+ ), level=nwAlert.ERROR, exc=exc)
return False
timeStamp = formatTimeStamp(time(), fileSafe=True)
diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py
index 96d40473..5de89756 100644
--- a/novelwriter/guimain.py
+++ b/novelwriter/guimain.py
@@ -752,7 +752,7 @@ class GuiMain(QMainWindow):
except Exception as exc:
self.makeAlert(self.tr(
"Could not read file. The file must be an existing text file."
- ), level=nwAlert.ERROR, exception=exc)
+ ), level=nwAlert.ERROR, exc=exc)
return False
if self.docEditor.docHandle() is None:
@@ -1094,21 +1094,19 @@ class GuiMain(QMainWindow):
return
def makeAlert(self, text: str, info: str = "", details: str = "",
- level: nwAlert = nwAlert.INFO, exception: Exception | None = None) -> None:
- """Alert both the user and the logger at the same time. The
- message can be either a string or a list of strings.
- """
+ level: nwAlert = nwAlert.INFO, exc: Exception | None = None) -> None:
+ """Alert both the user and the logger at the same time."""
logText = " ".join(filter(None, [text, info, details]))
if level == nwAlert.INFO:
logger.info(logText, stacklevel=2)
elif level == nwAlert.WARN:
logger.warning(logText, stacklevel=2)
elif level == nwAlert.ERROR:
- logger.error(logText, stacklevel=2, exc_info=exception)
+ logger.error(logText, stacklevel=2, exc_info=exc)
- if exception is not None:
- excText = f"{type(exception).__name__}: {str(exception)}"
- info = f"{info}
{excText}" if info else excText
+ if exc is not None:
+ tExc = f"{type(exc).__name__}: {str(exc)}"
+ info = f"{info}
{tExc}" if info else tExc
msgBox = QMessageBox(self)
msgBox.setWindowTitle(trConst(nwLabels.ALERT_NAME[level]))
diff --git a/tests/mocked.py b/tests/mocked.py
index cb25a51b..0fdd370f 100644
--- a/tests/mocked.py
+++ b/tests/mocked.py
@@ -51,7 +51,7 @@ class MockGuiMain(QObject):
def postLaunchTasks(self, cmdOpen):
return
- def makeAlert(self, text, info="", detals="", level=0, exception=None):
+ def makeAlert(self, text, info="", detals="", level=0, exc=None):
assert isinstance(text, str)
print("%s: %s" % (str(level), text))
self.lastAlert = str(text)