summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/execution_service/execution_server.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-12 17:45:14 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-16 10:01:34 +0200
commit49c2382ea5ea45966ef15140fce6ad89672e956c (patch)
treeda781f16f3315f662492af00648fc1469efa55a0 /src/buildtool/execution_api/execution_service/execution_server.cpp
parent7d925d8d6c5fed37bb74506c5b7589b99f5d2885 (diff)
downloadjustbuild-49c2382ea5ea45966ef15140fce6ad89672e956c.tar.gz
execution_response: Allow failures to be reported while populating
As populating the containers from remote response only takes place once, no assumptions should be made that this cannot fail (for example if wrong or invalid entries were produced). Instead, return error messages on failure to callers that can log accordingly.
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp
index 61fd3434..d59eb91f 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.cpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.cpp
@@ -94,8 +94,16 @@ auto ExecutionServiceImpl::ToIExecutionAction(
auto ExecutionServiceImpl::ToBazelExecuteResponse(
IExecutionResponse::Ptr const& i_execution_response) const noexcept
-> expected<::bazel_re::ExecuteResponse, std::string> {
- auto result = ToBazelActionResult(i_execution_response->Artifacts(),
- i_execution_response->DirectorySymlinks(),
+ auto artifacts = i_execution_response->Artifacts();
+ if (not artifacts) {
+ return unexpected{std::move(artifacts).error()};
+ }
+ auto dir_symlinks = i_execution_response->DirectorySymlinks();
+ if (not dir_symlinks) {
+ return unexpected{std::move(dir_symlinks).error()};
+ }
+ auto result = ToBazelActionResult(*std::move(artifacts).value(),
+ *std::move(dir_symlinks).value(),
storage_);
if (not result) {
return unexpected{std::move(result).error()};