From d1c38d9597e110bef92a548c86a651174bd385dc Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 13 Aug 2020 22:06:23 -0400 Subject: refactor(tvix): Make Store::buildPaths return a Status Make Store::buildPaths return a Status with [[nodiscard]] rather than throwing exceptions to signal failure. This is the beginning of a long road to refactor the entire store API to be status/statusor based instead of using exceptions. Change-Id: I2e32371c95a25b87ad129987c217d49c6d6e0c85 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1745 Tested-by: BuildkiteCI Reviewed-by: kanepyork --- third_party/nix/src/libstore/rpc-store.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'third_party/nix/src/libstore/rpc-store.cc') diff --git a/third_party/nix/src/libstore/rpc-store.cc b/third_party/nix/src/libstore/rpc-store.cc index a0b1ef9cfa..2d1278f40c 100644 --- a/third_party/nix/src/libstore/rpc-store.cc +++ b/third_party/nix/src/libstore/rpc-store.cc @@ -317,15 +317,17 @@ Path RpcStore::addTextToStore(const std::string& name, return result.path(); } -void RpcStore::buildPaths(const PathSet& paths, BuildMode buildMode) { +absl::Status RpcStore::buildPaths(const PathSet& paths, BuildMode buildMode) { ClientContext ctx; proto::BuildPathsRequest request; for (const auto& path : paths) { request.add_drvs(path); } + google::protobuf::Empty response; request.set_mode(nix::BuildModeToProto(buildMode)); - SuccessOrThrow(stub_->BuildPaths(&ctx, request, &response), __FUNCTION__); + return nix::util::proto::GRPCStatusToAbsl( + stub_->BuildPaths(&ctx, request, &response)); } BuildResult RpcStore::buildDerivation(const Path& drvPath, -- cgit 1.4.1