mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
close Anki after a panic occurs
Once the mutex has been poisoned the app is unusable, and users were struggling to close it. This also ensures we'll receive the original error report, instead of the follow-up poison errors that don't tell us what caused the issue. https://forums.ankiweb.net/t/error-message-keeps-popping-up/10494
This commit is contained in:
parent
dd1cb0112a
commit
a53c130177
1 changed files with 10 additions and 1 deletions
|
@ -93,7 +93,14 @@ class ErrorHandler(QObject):
|
|||
showWarning(markdown(tr.errors_accessing_db()))
|
||||
return
|
||||
|
||||
if self.mw.addonManager.dirty:
|
||||
must_close = False
|
||||
if "PanicException" in error:
|
||||
must_close = True
|
||||
txt = markdown(
|
||||
"**A fatal error occurred, and Anki must close. Please report this message on the forums.**"
|
||||
)
|
||||
error = f"{supportText() + self._addonText(error)}\n{error}"
|
||||
elif self.mw.addonManager.dirty:
|
||||
txt = markdown(tr.errors_addons_active_popup())
|
||||
error = f"{supportText() + self._addonText(error)}\n{error}"
|
||||
else:
|
||||
|
@ -103,6 +110,8 @@ class ErrorHandler(QObject):
|
|||
# show dialog
|
||||
txt = f"{txt}<div style='white-space: pre-wrap'>{error}</div>"
|
||||
showText(txt, type="html", copyBtn=True)
|
||||
if must_close:
|
||||
sys.exit(1)
|
||||
|
||||
def _addonText(self, error: str) -> str:
|
||||
matches = re.findall(r"addons21/(.*?)/", error)
|
||||
|
|
Loading…
Reference in a new issue