mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix show_exception's messagebox always formatting as plaintext (#4246)
* fix show_exception's messagebox always formatting as plaintext
* Revert "fix show_exception's messagebox always formatting as plaintext"
This reverts commit aec6dd9be8
.
* convert SearchError msg to markdown when in browser
This commit is contained in:
parent
aae9f53e79
commit
ab55440a05
2 changed files with 6 additions and 2 deletions
|
@ -246,7 +246,7 @@ def backend_exception_to_pylib(err: backend_pb2.BackendError) -> Exception:
|
|||
return BackendError(err.message, help_page, context, backtrace)
|
||||
|
||||
elif val == kind.SEARCH_ERROR:
|
||||
return SearchError(markdown(err.message), help_page, context, backtrace)
|
||||
return SearchError(err.message, help_page, context, backtrace)
|
||||
|
||||
elif val == kind.UNDO_EMPTY:
|
||||
return UndoEmpty(err.message, help_page, context, backtrace)
|
||||
|
|
|
@ -10,6 +10,8 @@ import re
|
|||
from collections.abc import Callable, Sequence
|
||||
from typing import Any, cast
|
||||
|
||||
from markdown import markdown
|
||||
|
||||
import aqt
|
||||
import aqt.browser
|
||||
import aqt.editor
|
||||
|
@ -20,7 +22,7 @@ from anki.cards import Card, CardId
|
|||
from anki.collection import Collection, Config, OpChanges, SearchNode
|
||||
from anki.consts import *
|
||||
from anki.decks import DeckId
|
||||
from anki.errors import NotFoundError
|
||||
from anki.errors import NotFoundError, SearchError
|
||||
from anki.lang import without_unicode_isolation
|
||||
from anki.models import NotetypeId
|
||||
from anki.notes import NoteId
|
||||
|
@ -498,6 +500,8 @@ class Browser(QMainWindow):
|
|||
text = self.current_search()
|
||||
try:
|
||||
normed = self.col.build_search_string(text)
|
||||
except SearchError as err:
|
||||
showWarning(markdown(str(err)))
|
||||
except Exception as err:
|
||||
showWarning(str(err))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue