From d8386d6f7ef7019c931d8b205ee4ecbe52f8ca8d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 3 Aug 2020 22:15:27 -0400 Subject: chore(tvix): Make not implemented errors nix::Unsupported Without this, these errors print as "uncaught exception of type std::string", but with this they print using nix's built-in error printer, which will be nice to have as we bang out the remaining store API methods. Co-authored-by: Vincent Ambo Change-Id: I9bd4f77f65b27c8f97b727b98ef62e2061999e71 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1636 Reviewed-by: tazjin Tested-by: BuildkiteCI --- third_party/nix/src/libstore/rpc-store.cc | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'third_party/nix') diff --git a/third_party/nix/src/libstore/rpc-store.cc b/third_party/nix/src/libstore/rpc-store.cc index 9c7c662356e1..5a0a2c98969a 100644 --- a/third_party/nix/src/libstore/rpc-store.cc +++ b/third_party/nix/src/libstore/rpc-store.cc @@ -290,20 +290,20 @@ void RpcStore::querySubstitutablePathInfos(const PathSet& paths, void RpcStore::addToStore(const ValidPathInfo& info, Source& narSource, RepairFlag repair, CheckSigsFlag checkSigs, std::shared_ptr accessor) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::addToStore(const ValidPathInfo& info, const ref& nar, RepairFlag repair, CheckSigsFlag checkSigs, std::shared_ptr accessor) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } Path RpcStore::addToStore(const std::string& name, const Path& srcPath, bool recursive, HashType hashAlgo, PathFilter& filter, RepairFlag repair) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } Path RpcStore::addTextToStore(const std::string& name, @@ -326,7 +326,7 @@ Path RpcStore::addTextToStore(const std::string& name, } void RpcStore::narFromPath(const Path& path, Sink& sink) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::buildPaths(const PathSet& paths, BuildMode buildMode) { @@ -343,78 +343,80 @@ void RpcStore::buildPaths(const PathSet& paths, BuildMode buildMode) { BuildResult RpcStore::buildDerivation(const Path& drvPath, const BasicDerivation& drv, BuildMode buildMode) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::ensurePath(const Path& path) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::addTempRoot(const Path& path) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::addIndirectRoot(const Path& path) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::syncWithGC() { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } Roots RpcStore::findRoots(bool censor) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::collectGarbage(const GCOptions& options, GCResults& results) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::optimiseStore() { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } bool RpcStore::verifyStore(bool checkContents, RepairFlag repair) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::addSignatures(const Path& storePath, const StringSet& sigs) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::computeFSClosure(const PathSet& paths, PathSet& paths_, bool flipDirection, bool includeOutputs, bool includeDerivers) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::queryMissing(const PathSet& targets, PathSet& willBuild, PathSet& willSubstitute, PathSet& unknown, unsigned long long& downloadSize, unsigned long long& narSize) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } std::shared_ptr RpcStore::getBuildLog(const Path& path) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } -void RpcStore::connect() { throw absl::StrCat("Not implemented ", __func__); } +void RpcStore::connect() { + throw Unsupported(absl::StrCat("Not implemented ", __func__)); +} unsigned int RpcStore::getProtocol() { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } int RpcStore::getPriority() { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } Path RpcStore::toRealPath(const Path& storePath) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } void RpcStore::createUser(const std::string& userName, uid_t userId) { - throw absl::StrCat("Not implemented ", __func__); + throw Unsupported(absl::StrCat("Not implemented ", __func__)); } } // namespace store -- cgit 1.4.1