From b7fc5fa09a90ec383b58d846533b2b38ba7c577e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 6 Oct 2016 17:53:33 +0200 Subject: Error propagation should work now. --- common/store.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/common/store.cpp b/common/store.cpp index 0ecdcd2..7783f91 100644 --- a/common/store.cpp +++ b/common/store.cpp @@ -259,31 +259,21 @@ KAsync::Job Store::synchronize(const Sink::Query &query) { auto resources = getResources(query).keys(); SinkTrace() << "synchronize" << resources; - //FIXME only necessary because each doesn't propagate errors - auto errorFlag = new bool; return KAsync::value(resources) - .template each([query, errorFlag](const QByteArray &resource) { + .template each([query](const QByteArray &resource) { SinkTrace() << "Synchronizing " << resource; auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource)); resourceAccess->open(); return resourceAccess->synchronizeResource(true, false) .addToContext(resourceAccess) - .then([errorFlag](const KAsync::Error &error) { + .then([](const KAsync::Error &error) { if (error) { - *errorFlag = true; SinkWarning() << "Error during sync."; return KAsync::error(error); } SinkTrace() << "synced."; return KAsync::null(); }); - }) - .then([errorFlag]() { - if (*errorFlag) { - return KAsync::error("Error during sync."); - } - delete errorFlag; - return KAsync::null(); }); } -- cgit v1.2.3