aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-09-20 17:25:44 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-09-20 17:25:44 +0200
commitf12d56b27b9d8ed2411788f24af5b6dc63563568 (patch)
tree1afa55dc073a3919b8eb78baef93eeb25a732e29 /src
parent794e4ab475399363982f5602ed1ba12bf0be4343 (diff)
Improve robustness
Diffstat (limited to 'src')
-rw-r--r--src/libstore/download.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index ca324595a..34cb8ed60 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -98,7 +98,11 @@ struct CurlDownloader : public Downloader
{
assert(!done);
done = true;
- failure(std::make_exception_ptr(e));
+ try {
+ throw e;
+ } catch (...) {
+ callFailure(failure);
+ }
}
size_t writeCallback(void * contents, size_t size, size_t nmemb)
@@ -241,8 +245,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 :