diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-18 18:08:02 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-18 18:08:02 +0000 |
commit | fb432b0bd2b102c42057628e0cce3039ce167810 (patch) | |
tree | ad4a4d7a79f153ef0bb2bd405bd3bde157cccd54 /src/libstore/filetransfer.cc | |
parent | 74b219ef6e5e171c56c8ad7385969e0d0df09ed8 (diff) | |
parent | 639e20dc3ed9c5b28138285653912de78fe0507f (diff) |
Merge remote-tracking branch 'obsidian/fix-url-format' into add-body-to-network-errors
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r-- | src/libstore/filetransfer.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index fa8ad33f5..9ae682bbb 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -424,16 +424,13 @@ struct curlFileTransfer : public FileTransfer response = teeSink->data; auto exc = code == CURLE_ABORTED_BY_CALLBACK && _isInterrupted - ? FileTransferError(Interrupted, response, fmt("%s of '%s' was interrupted", request.verb(), request.uri)) + ? FileTransferError(Interrupted, response, "%s of '%s' was interrupted", request.verb(), request.uri) : httpStatus != 0 - ? FileTransferError(err, response, - fmt("unable to %s '%s': HTTP error %d", - request.verb(), request.uri, httpStatus) - + (code == CURLE_OK ? "" : fmt(" (curl error: %s)", curl_easy_strerror(code))) - ) - : FileTransferError(err, response, - fmt("unable to %s '%s': %s (%d)", - request.verb(), request.uri, curl_easy_strerror(code), code)); + ? FileTransferError(err, response, "unable to %s '%s': HTTP error %d%s", + request.verb(), request.uri, httpStatus, + code == CURLE_OK ? "" : fmt(" (curl error: %s)", curl_easy_strerror(code))) + : FileTransferError(err, response, "unable to %s '%s': %s (%d)", + request.verb(), request.uri, curl_easy_strerror(code), code); /* If this is a transient error, then maybe retry the download after a while. If we're writing to a @@ -689,7 +686,7 @@ struct curlFileTransfer : public FileTransfer auto s3Res = s3Helper.getObject(bucketName, key); FileTransferResult res; if (!s3Res.data) - throw FileTransferError(NotFound, nullptr, fmt("S3 object '%s' does not exist", request.uri)); + throw FileTransferError(NotFound, nullptr, "S3 object '%s' does not exist", request.uri); res.data = s3Res.data; callback(std::move(res)); #else |