Better handling of not being able to connect to the database.
This commit is contained in:
parent
a69aa401b2
commit
6599498556
1 changed files with 10 additions and 6 deletions
|
|
@ -57,9 +57,8 @@ void MainWindow::setConfig(const ConnectionConfig &config)
|
||||||
m_config = config;
|
m_config = config;
|
||||||
try {
|
try {
|
||||||
auto res = OpenDatabase::createOpenDatabase(config);
|
auto res = OpenDatabase::createOpenDatabase(config);
|
||||||
if (res.valid()) {
|
//if (res.valid()) {
|
||||||
m_database = res.get();
|
m_database = res.get();
|
||||||
}
|
|
||||||
QString title = "pglab - ";
|
QString title = "pglab - ";
|
||||||
title += m_config.name().c_str();
|
title += m_config.name().c_str();
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
@ -71,9 +70,14 @@ void MainWindow::setConfig(const ConnectionConfig &config)
|
||||||
|
|
||||||
newSqlPage();
|
newSqlPage();
|
||||||
} catch (std::runtime_error &ex) {
|
} catch (std::runtime_error &ex) {
|
||||||
QMessageBox msgBox;
|
// QMessageBox msgBox;
|
||||||
msgBox.setText(QString::fromUtf8(ex.what()));
|
// msgBox.setText(QString::fromUtf8(ex.what()));
|
||||||
msgBox.exec();
|
// msgBox.exec();
|
||||||
|
|
||||||
|
QMessageBox::critical(this, "Error reading database",
|
||||||
|
QString::fromUtf8(ex.what()));
|
||||||
|
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue