mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 10:50:38 +02:00
edit error handling
This commit is contained in:
parent
fe0954edf1
commit
b405d95320
@ -45,7 +45,6 @@ bool SyncManager::startSynchronization()
|
||||
|
||||
qInfo(syncmanager) << equals;
|
||||
qInfo(syncmanager) << "SYNCHRONIZATION BEGIN";
|
||||
|
||||
qInfo(syncmanager) << equals;
|
||||
qInfo(syncmanager) << "DOWNLOADING DATA -> BEGIN";
|
||||
qInfo(syncmanager) << dash;
|
||||
@ -62,15 +61,14 @@ bool SyncManager::startSynchronization()
|
||||
|
||||
colnod->downloadData(mlastSync.timestamp());
|
||||
connect(colnod.get(), &ColnodAPI::downloadDataFinished, [=](std::shared_ptr<Data> colnodData) {
|
||||
qInfo(syncmanager) << "DOWNLOADING DATA -> FINISHED";
|
||||
qInfo(syncmanager) << equals;
|
||||
|
||||
if (!colnodData) {
|
||||
qCritical(syncmanager) << "Not possible to get correct data from colnod";
|
||||
QCoreApplication::exit(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo(syncmanager) << "DOWNLOADING DATA -> FINISHED";
|
||||
qInfo(syncmanager) << equals;
|
||||
// NOW I SHOULD HAVE VALID DATA FROM COLNOD
|
||||
|
||||
|
||||
@ -92,7 +90,11 @@ bool SyncManager::startSynchronization()
|
||||
}
|
||||
|
||||
// data is processed to other sides
|
||||
connect(colnod.get(), &ColnodAPI::dataProcessFinished, [&](){
|
||||
connect(colnod.get(), &ColnodAPI::dataProcessFinished, [&](bool success){
|
||||
if (!success) {
|
||||
qCritical(syncmanager) << "Not possible to upload data to colnod";
|
||||
}
|
||||
|
||||
qInfo(syncmanager) << "PROCESSING DATA -> FINISHED";
|
||||
qInfo(syncmanager) << equals;
|
||||
|
||||
@ -105,6 +107,7 @@ bool SyncManager::startSynchronization()
|
||||
|
||||
// updated data are ready
|
||||
connect(tokensRequest.get(), &serversdk::Request::finished, [=](){
|
||||
|
||||
auto uploadedData = std::make_shared<Data>();
|
||||
uploadedData->loadTokensFromJson(tokensRequest->responseData());
|
||||
|
||||
@ -139,9 +142,7 @@ bool SyncManager::startSynchronization()
|
||||
|
||||
|
||||
});
|
||||
colnod->processData(preparedData->databaseData); // TODO: errors???
|
||||
|
||||
//qCritical(syncmanager) << "Not possible to upload data to colnod";
|
||||
colnod->processData(preparedData->databaseData);
|
||||
});
|
||||
|
||||
return true;
|
||||
@ -162,7 +163,7 @@ std::unique_ptr<PreparedData> SyncManager::prepareDataNew(const std::shared_ptr<
|
||||
qInfo(syncmanager) << "Resolve conflicts ( changes on same item on both Colnod and DB ):";
|
||||
qInfo(syncmanager) << dash;
|
||||
|
||||
|
||||
// add all data which should be pushed to database
|
||||
for (const auto &colnodToken : colnodData->updatedTokens) {
|
||||
|
||||
// not conflict so add to prepered tokens
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user