Improved error reporting
This commit is contained in:
parent
6cf7b52453
commit
457b09f15c
12 changed files with 110 additions and 94 deletions
|
|
@ -254,13 +254,18 @@ void ConnectionConfigurationWidget::testConnection()
|
|||
cc.setPassword(password);
|
||||
|
||||
auto qthis = QPointer(this);
|
||||
QFuture<void> result = QtConcurrent::run([cc] {
|
||||
return TestConnection(cc);
|
||||
}).then(qApp, [qthis](TestConnectionResult result) {
|
||||
if (qthis) {
|
||||
qthis.data()->handleTestResult(result);
|
||||
QFuture<void> result = QtConcurrent::run(
|
||||
[cc]
|
||||
{
|
||||
return TestConnection(cc);
|
||||
}
|
||||
});
|
||||
).then(qApp,
|
||||
[qthis](TestConnectionResult result)
|
||||
{
|
||||
if (qthis)
|
||||
qthis.data()->handleTestResult(result);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void ConnectionConfigurationWidget::handleTestResult(TestConnectionResult result)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,14 @@ void DatabaseWindow::setConfig(const ConnectionConfig &config)
|
|||
if (qthis)
|
||||
qthis.data()->catalogLoaded(db);
|
||||
}
|
||||
).onFailed(qApp, [qthis](OpenDatabaseException &ex)
|
||||
{
|
||||
if (qthis) {
|
||||
QMessageBox::critical(qthis.data(), "Error reading database",
|
||||
ex.text());
|
||||
qthis.data()->close();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include "CustomDataRole.h"
|
||||
#include <QtConcurrent>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
#include <QMessageBox>
|
||||
#include "Pgsql_oids.h"
|
||||
#include "Pgsql_PgException.h"
|
||||
|
|
@ -247,9 +246,9 @@ void CrudModel::initRowMapping()
|
|||
m_rowMapping.emplace_back(i);
|
||||
}
|
||||
|
||||
void CrudModel::connectionStateChanged(ASyncDBConnection::State state)
|
||||
void CrudModel::connectionStateChanged(ASyncDBConnection::StateData state)
|
||||
{
|
||||
switch (state) {
|
||||
switch (state.State) {
|
||||
case ASyncDBConnection::State::NotConnected:
|
||||
break;
|
||||
case ASyncDBConnection::State::Connecting:
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ private:
|
|||
private slots:
|
||||
|
||||
void loadIntoModel(std::shared_ptr<Pgsql::Result> data);
|
||||
void connectionStateChanged(ASyncDBConnection::State state);
|
||||
void connectionStateChanged(ASyncDBConnection::StateData state);
|
||||
};
|
||||
|
||||
#endif // CRUDMODEL_H
|
||||
|
|
|
|||
|
|
@ -314,11 +314,12 @@ void QueryTool::queryTextChanged()
|
|||
setQueryTextChanged(true);
|
||||
}
|
||||
|
||||
void QueryTool::connectionStateChanged(ASyncDBConnection::State state)
|
||||
void QueryTool::connectionStateChanged(ASyncDBConnection::StateData state)
|
||||
{
|
||||
QString iconname;
|
||||
switch (state) {
|
||||
switch (state.State) {
|
||||
case ASyncDBConnection::State::NotConnected:
|
||||
QMessageBox::warning(this, "pglab", tr("Warning connection and any of its session state has been lost"));
|
||||
startConnect();
|
||||
iconname = "red.png";
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ private slots:
|
|||
void query_ready(std::shared_ptr<Pgsql::Result>, qint64 elapsedms);
|
||||
|
||||
void queryTextChanged();
|
||||
void connectionStateChanged(ASyncDBConnection::State state);
|
||||
void connectionStateChanged(ASyncDBConnection::StateData state);
|
||||
void receiveNotice(Pgsql::ErrorDetails notice);
|
||||
|
||||
void startConnect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue