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 <rikingcoding@gmail.com>
This commit is contained in:
Griffin Smith 2020-08-13 22:06:23 -04:00 committed by glittershark
parent aef3607bd3
commit d1c38d9597
18 changed files with 137 additions and 32 deletions

View file

@ -21,6 +21,7 @@
#include "libstore/store-api.hh"
#include "libutil/archive.hh"
#include "libutil/hash.hh"
#include "libutil/proto.hh"
#include "libutil/serialise.hh"
#include "libutil/types.hh"
@ -288,9 +289,8 @@ class WorkerServiceImpl final : public WorkerService::Service {
// TODO(grfn): If mode is repair and not trusted, we need to return an
// error here (but we can't yet because we don't know anything about
// trusted users)
store_->buildPaths(drvs, mode.value());
return Status::OK;
return nix::util::proto::AbslToGRPCStatus(
store_->buildPaths(drvs, mode.value()));
},
__FUNCTION__);
}