Better error reporting of problems during catalog load.

This commit is contained in:
eelke 2017-12-19 18:17:41 +01:00
parent 2a29bed75e
commit c37e9eccb8
2 changed files with 24 additions and 15 deletions

View file

@ -55,20 +55,26 @@ QueryTab *MainWindow::GetActiveQueryTab()
void MainWindow::setConfig(const ConnectionConfig &config)
{
m_config = config;
auto res = OpenDatabase::createOpenDatabase(config);
if (res.valid()) {
m_database = res.get();
try {
auto res = OpenDatabase::createOpenDatabase(config);
if (res.valid()) {
m_database = res.get();
}
QString title = "pglab - ";
title += m_config.name().c_str();
setWindowTitle(title);
auto tt = new TablesPage(this);
tt->setCatalog(m_database->catalogue());
ui->tabWidget->addTab(tt, "Tables");
ui->tabWidget->setCurrentWidget(tt);
newSqlPage();
} catch (std::runtime_error &ex) {
QMessageBox msgBox;
msgBox.setText(QString::fromUtf8(ex.what()));
msgBox.exec();
}
QString title = "pglab - ";
title += m_config.name().c_str();
setWindowTitle(title);
auto tt = new TablesPage(this);
tt->setCatalog(m_database->catalogue());
ui->tabWidget->addTab(tt, "Tables");
ui->tabWidget->setCurrentWidget(tt);
newSqlPage();
}
void MainWindow::on_actionLoad_SQL_triggered()