Improve binary cache upload messages
Don't say "download" when we mean "upload".
This commit is contained in:
parent
f0d9909f10
commit
73357500ac
|
@ -102,7 +102,9 @@ struct CurlDownloader : public Downloader
|
||||||
Callback<DownloadResult> callback)
|
Callback<DownloadResult> callback)
|
||||||
: downloader(downloader)
|
: downloader(downloader)
|
||||||
, request(request)
|
, request(request)
|
||||||
, act(*logger, lvlTalkative, actDownload, fmt("downloading '%s'", request.uri), {request.uri}, request.parentAct)
|
, act(*logger, lvlTalkative, actDownload,
|
||||||
|
fmt(request.data ? "uploading '%s'" : "downloading '%s'", request.uri),
|
||||||
|
{request.uri}, request.parentAct)
|
||||||
, callback(callback)
|
, callback(callback)
|
||||||
{
|
{
|
||||||
if (!request.expectedETag.empty())
|
if (!request.expectedETag.empty())
|
||||||
|
@ -371,12 +373,20 @@ struct CurlDownloader : public Downloader
|
||||||
|
|
||||||
attempt++;
|
attempt++;
|
||||||
|
|
||||||
|
auto verb = request.data ? "upload" : "download";
|
||||||
|
|
||||||
auto exc =
|
auto exc =
|
||||||
code == CURLE_ABORTED_BY_CALLBACK && _isInterrupted
|
code == CURLE_ABORTED_BY_CALLBACK && _isInterrupted
|
||||||
? DownloadError(Interrupted, format("download of '%s' was interrupted") % request.uri)
|
? DownloadError(Interrupted, fmt("%s of '%s' was interrupted", verb, request.uri))
|
||||||
: httpStatus != 0
|
: httpStatus != 0
|
||||||
? DownloadError(err, format("unable to download '%s': HTTP error %d (curl error: %s)") % request.uri % httpStatus % curl_easy_strerror(code))
|
? DownloadError(err,
|
||||||
: DownloadError(err, format("unable to download '%s': %s (%d)") % request.uri % curl_easy_strerror(code) % code);
|
fmt("unable to %s '%s': HTTP error %d",
|
||||||
|
verb, request.uri, httpStatus)
|
||||||
|
+ (code == CURLE_OK ? "" : fmt(" (curl error: %s)", curl_easy_strerror(code)))
|
||||||
|
)
|
||||||
|
: DownloadError(err,
|
||||||
|
fmt("unable to %s '%s': %s (%d)",
|
||||||
|
verb, request.uri, curl_easy_strerror(code), code));
|
||||||
|
|
||||||
/* If this is a transient error, then maybe retry the
|
/* If this is a transient error, then maybe retry the
|
||||||
download after a while. */
|
download after a while. */
|
||||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
||||||
try {
|
try {
|
||||||
getDownloader()->download(req);
|
getDownloader()->download(req);
|
||||||
} catch (DownloadError & e) {
|
} catch (DownloadError & e) {
|
||||||
throw UploadToHTTP(format("uploading to HTTP binary cache at %1% not supported: %2%") % cacheUri % e.msg());
|
throw UploadToHTTP("while uploading to HTTP binary cache at '%s': %s", cacheUri, e.msg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue