about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/download.cc4
-rw-r--r--src/libstore/http-binary-cache-store.cc4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index ca324595a300..d7d0e29c0626 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -98,7 +98,7 @@ struct CurlDownloader : public Downloader
         {
             assert(!done);
             done = true;
-            failure(std::make_exception_ptr(e));
+            callFailure(failure, std::make_exception_ptr(e));
         }
 
         size_t writeCallback(void * contents, size_t size, size_t nmemb)
@@ -241,8 +241,8 @@ struct CurlDownloader : public Downloader
                 (httpStatus == 200 || httpStatus == 304 || httpStatus == 226 /* FTP */ || httpStatus == 0 /* other protocol */))
             {
                 result.cached = httpStatus == 304;
-                success(result);
                 done = true;
+                callSuccess(success, failure, const_cast<const DownloadResult &>(result));
             } else {
                 Error err =
                     (httpStatus == 404 || code == CURLE_FILE_COULDNT_READ_FILE) ? NotFound :
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 60728de04c9c..74ae7a4d198a 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -86,7 +86,9 @@ protected:
                     std::rethrow_exception(exc);
                 } catch (DownloadError & e) {
                     if (e.error == Downloader::NotFound || e.error == Downloader::Forbidden)
-                        success(0);
+                        return success(0);
+                    failure(exc);
+                } catch (...) {
                     failure(exc);
                 }
             });