aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.cc
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-03-02 14:59:15 +0100
committerThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-03-02 14:59:15 +0100
commit1a825b6919e9a3a98caec58192bb89dfb4e5bcfa (patch)
tree0751630f65c12bcb7802d38cf72f37bafa818908 /src/libstore/filetransfer.cc
parent85dbf9de8e30d07139d983ee4066332c477ee0f9 (diff)
Log the decompressed body in case of http errors
Don't show the users the raw (possibly compressed) error message as everyone isn't able to decompress brotli in their brain.
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r--src/libstore/filetransfer.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc
index 1c8676a59..6a4778d1f 100644
--- a/src/libstore/filetransfer.cc
+++ b/src/libstore/filetransfer.cc
@@ -88,6 +88,10 @@ struct curlFileTransfer : public FileTransfer
{request.uri}, request.parentAct)
, callback(std::move(callback))
, finalSink([this](std::string_view data) {
+ if (errorSink) {
+ (*errorSink)(data);
+ }
+
if (this->request.dataCallback) {
auto httpStatus = getHTTPStatus();
@@ -163,8 +167,6 @@ struct curlFileTransfer : public FileTransfer
}
}
- if (errorSink)
- (*errorSink)({(char *) contents, realSize});
(*decompressionSink)({(char *) contents, realSize});
return realSize;