about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-10T12·57+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-10T16·05+0200
commit9204ea7294bf35beacbecd468a3c9690780b7ca5 (patch)
tree14ddbfc43fdd424cbe2aecb79428478747bdc80c /src/libstore
parentf294623d1d2d42cd6671c061d3e146b05b930afb (diff)
Show HTTP error codes
Diffstat (limited to 'src/libstore')
-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 cf3929cadd65..ce5584188a12 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -195,8 +195,12 @@ struct CurlDownloader : public Downloader
             Error err =
                 httpStatus == 404 ? NotFound :
                 httpStatus == 403 ? Forbidden : Misc;
-            throw DownloadError(err, format("unable to download ‘%1%’: %2% (%3%)")
-                % url % curl_easy_strerror(res) % res);
+            if (res == CURLE_HTTP_RETURNED_ERROR && httpStatus != -1)
+                throw DownloadError(err, format("unable to download ‘%s’: HTTP error %d")
+                    % url % httpStatus);
+            else
+                throw DownloadError(err, format("unable to download ‘%s’: %s (%d)")
+                    % url % curl_easy_strerror(res) % res);
         }
 
         if (httpStatus == 304) return false;