From 09804a83ccb46397e569f4ee315fabbcb0f6a629 Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 29 Apr 2019 23:05:51 +0200 Subject: [PATCH] gui: handle search exception (again after refactoring) --- gui/mainwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 4d0bacf..985c212 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -15,6 +15,7 @@ #include "ui_mainwindow.h" #include "clicklabel.h" #include "../shared/sqlitesearch.h" +#include "../shared/qssgeneralexception.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); @@ -45,8 +46,15 @@ void MainWindow::connectSignals() connect(&searchWatcher, &QFutureWatcher::finished, this, [&] { - auto results = searchWatcher.future().result(); - handleSearchResults(results); + try + { + auto results = searchWatcher.future().result(); + handleSearchResults(results); + } + catch(QSSGeneralException &e) + { + handleSearchError(e.message); + } }); connect(&pdfWorkerWatcher, &QFutureWatcher::resultReadyAt, this,