diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2023-12-12 14:50:49 +0100 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2023-12-13 23:04:36 +0100 |
commit | 2c60618bc6a49ea3b88e65991b14243f98555193 (patch) | |
tree | dc9acfada0518fd259e2e16ecbea6f9fd6253fd8 /src | |
parent | 546d510d5e5fd99d931fc87347398024c4fc2b18 (diff) | |
download | justbuild-2c60618bc6a49ea3b88e65991b14243f98555193.tar.gz |
bytestream client: log more info in case of a failure
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bytestream_client.hpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp index dd1aa773..79ed20ca 100644 --- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp @@ -47,7 +47,10 @@ class ByteStreamClient { if (not finished_) { auto status = reader_->Finish(); if (not status.ok()) { - LogStatus(logger_, LogLevel::Debug, status); + logger_->Emit(LogLevel::Error, + "{}: {}", + static_cast<int>(status.error_code()), + status.error_message()); return std::nullopt; } finished_ = true; @@ -150,10 +153,18 @@ class ByteStreamClient { LogStatus(&logger_, LogLevel::Error, status); return false; } - - return gsl::narrow<std::size_t>(response.committed_size()) == - data.size(); + if (gsl::narrow<std::size_t>(response.committed_size()) != + data.size()) { + logger_.Emit( + LogLevel::Error, + "Commited size {} is different from the original one {}.", + response.committed_size(), + data.size()); + return false; + } + return true; } catch (...) { + logger_.Emit(LogLevel::Error, "Caught exception in Write"); return false; } } |