Skip to content

Commit 739d71b

Browse files
committed
Fix #2101115 [Error with match book to device](https://bugs.launchpad.net/calibre/+bug/2101115)
1 parent bc81cd9 commit 739d71b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/calibre/gui2/dialogs/match_books.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from calibre.gui2.dialogs.match_books_ui import Ui_MatchBooks
1313
from calibre.utils.icu import sort_key
1414
from calibre.utils.localization import ngettext
15+
from calibre.utils.search_query_parser import ParseException
1516

1617

1718
class TableItem(QTableWidgetItem):
@@ -134,7 +135,11 @@ def do_search(self):
134135
try:
135136
self.search_button.setEnabled(False)
136137
QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor))
137-
books = self.library_db.data.search(query, return_matches=True)
138+
try:
139+
books = self.library_db.data.search(query, return_matches=True)
140+
except ParseException as e:
141+
return error_dialog(self.gui, _('Could not search'), _(
142+
'The search expression {} is not valid.').format(query), det_msg=str(e), show=True)
138143
self.books_table.setRowCount(len(books))
139144

140145
self.books_table.setSortingEnabled(False)

0 commit comments

Comments
 (0)