diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-20 16:55:21 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-20 16:55:21 +0200 |
commit | 227610b7399905fca38e0f09053d78e2e866f32e (patch) | |
tree | 133dbdfd137ada5833fa64bbf8c8873b91af82f9 | |
parent | d67b886dd2cf51264e4d6da680e268015a0a7031 (diff) | |
download | sink-227610b7399905fca38e0f09053d78e2e866f32e.tar.gz sink-227610b7399905fca38e0f09053d78e2e866f32e.zip |
Ensure change-replay errors make it through to the correct error
handling and are appropriately dealt with.
-rw-r--r-- | common/changereplay.cpp | 7 | ||||
-rw-r--r-- | common/synchronizer.cpp | 7 | ||||
-rw-r--r-- | examples/imapresource/imapresource.cpp | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/common/changereplay.cpp b/common/changereplay.cpp index 75b9a4c..0adbd78 100644 --- a/common/changereplay.cpp +++ b/common/changereplay.cpp | |||
@@ -147,7 +147,7 @@ KAsync::Job<void> ChangeReplay::replayNextRevision() | |||
147 | if (error) { | 147 | if (error) { |
148 | SinkWarningCtx(mLogCtx) << "Change replay failed: " << error << "Last replayed revision: " << *lastReplayedRevision; | 148 | SinkWarningCtx(mLogCtx) << "Change replay failed: " << error << "Last replayed revision: " << *lastReplayedRevision; |
149 | //We're probably not online or so, so postpone retrying | 149 | //We're probably not online or so, so postpone retrying |
150 | return KAsync::value(KAsync::Break); | 150 | return KAsync::value(KAsync::Break).then(KAsync::error<KAsync::ControlFlowFlag>(error)); |
151 | } | 151 | } |
152 | SinkTraceCtx(mLogCtx) << "Replayed until: " << *lastReplayedRevision; | 152 | SinkTraceCtx(mLogCtx) << "Replayed until: " << *lastReplayedRevision; |
153 | 153 | ||
@@ -179,6 +179,11 @@ KAsync::Job<void> ChangeReplay::replayNextRevision() | |||
179 | emit changesReplayed(); | 179 | emit changesReplayed(); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | if (error) { | ||
183 | return KAsync::error(error); | ||
184 | } else { | ||
185 | return KAsync::null(); | ||
186 | } | ||
182 | }).guard(&mGuard); | 187 | }).guard(&mGuard); |
183 | } | 188 | } |
184 | 189 | ||
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 3ef7eb7..b1ff29c 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -629,11 +629,14 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
629 | } | 629 | } |
630 | }) | 630 | }) |
631 | .then([this](const KAsync::Error &error) { | 631 | .then([this](const KAsync::Error &error) { |
632 | //We need to commit here otherwise the next change-replay step will abort the transaction | ||
633 | mSyncStore.clear(); | ||
634 | mSyncTransaction.commit(); | ||
632 | if (error) { | 635 | if (error) { |
633 | SinkWarningCtx(mLogCtx) << "Failed to replay change: " << error.errorMessage; | 636 | SinkWarningCtx(mLogCtx) << "Failed to replay change: " << error.errorMessage; |
637 | return KAsync::error(error); | ||
634 | } | 638 | } |
635 | mSyncStore.clear(); | 639 | return KAsync::null(); |
636 | mSyncTransaction.commit(); | ||
637 | }); | 640 | }); |
638 | } | 641 | } |
639 | 642 | ||
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index bfe43bf..29ff03b 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -680,7 +680,7 @@ public: | |||
680 | if (error) { | 680 | if (error) { |
681 | SinkWarning() << "Error during changereplay: " << error.errorMessage; | 681 | SinkWarning() << "Error during changereplay: " << error.errorMessage; |
682 | return imap->logout() | 682 | return imap->logout() |
683 | .then(KAsync::error<QByteArray>(error)); | 683 | .then(KAsync::error<QByteArray>(getError(error))); |
684 | } | 684 | } |
685 | return imap->logout() | 685 | return imap->logout() |
686 | .then(KAsync::value(remoteId)); | 686 | .then(KAsync::value(remoteId)); |