Fix: openening not accessible database crashes program.

OpenDatabase::createOpenDatabase now uses QException derived exception to report failure.
This makes it possible to catch the exception in a background thread and rethrow it when the Future is read.
Which makes it possible for the database window to properly report the problem.
This commit is contained in:
eelke 2019-01-29 19:41:27 +01:00
parent 3820fb2600
commit ecae0464f9
5 changed files with 36 additions and 24 deletions

View file

@ -1,6 +1,7 @@
#include "DatabaseWindow.h"
#include "plugin_support/IPluginContentWidgetContext.h"
#include "util.h"
#include "OpenDatabase.h"
#include "MasterController.h"
#include "TaskExecutor.h"
#include <QApplication>
@ -84,9 +85,8 @@ void DatabaseWindow::catalogLoaded()
m_tabWidget->addTab(sequences_page, "Sequences");
newCreateTablePage();
} catch (std::runtime_error &ex) {
QMessageBox::critical(this, "Error reading database",
QString::fromUtf8(ex.what()));
} catch (const OpenDatabaseException &ex) {
QMessageBox::critical(this, "Error reading database", ex.text());
close();
}