commit c1e12f4f81fc20f8a98c30f2f0c670bd616be0b0
parent bb18915c9a765b3ad6db79cd62944d26701c9614
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 26 Feb 2017 20:55:51 -0500
don't report "abort" as a user error
Diffstat:
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/download.cpp b/src/download.cpp
@@ -150,7 +150,7 @@ void Download::run(DownloadContext *ctx)
const CURLcode res = curl_easy_perform(ctx->m_curl);
if(aborted())
- finish(Aborted, "aborted by user");
+ finish(Aborted, "aborted");
else if(res != CURLE_OK) {
const auto err = format("%s (%d): %s") % curl_easy_strerror(res) % res % errbuf;
finish(Failure, err.str());
diff --git a/src/transaction.cpp b/src/transaction.cpp
@@ -171,17 +171,20 @@ void Transaction::uninstall(const Registry::Entry &entry)
bool Transaction::saveFile(Download *dl, const Path &path)
{
- if(dl->state() != Download::Success) {
+ switch(dl->state()) {
+ case ThreadTask::Success:
+ if(FS::write(path, dl->contents()))
+ return true;
+ else
+ m_receipt.addError({FS::lastError(), path.join()});
+ break;
+ case ThreadTask::Failure:
m_receipt.addError({dl->errorString(), dl->url()});
+ default:
return false;
}
- if(!FS::write(path, dl->contents())) {
- m_receipt.addError({FS::lastError(), path.join()});
- return false;
- }
-
- return true;
+ return false;
}
bool Transaction::runTasks()