about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-04T02·15-0400
committerglittershark <grfn@gws.fyi>2020-08-04T22·49+0000
commitd8386d6f7ef7019c931d8b205ee4ecbe52f8ca8d (patch)
tree1c443d9bf159c1c1fc2e8628dc7429c1c80d34d5 /third_party
parente634e2757721c420bf52e485019c13bc0b0e0f91 (diff)
chore(tvix): Make not implemented errors nix::Unsupported r/1582
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 <mail@tazj.in>
Change-Id: I9bd4f77f65b27c8f97b727b98ef62e2061999e71
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1636
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'third_party')
-rw-r--r--third_party/nix/src/libstore/rpc-store.cc46
1 files changed, 24 insertions, 22 deletions
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<FSAccessor> accessor) {
-  throw absl::StrCat("Not implemented ", __func__);
+  throw Unsupported(absl::StrCat("Not implemented ", __func__));
 }
 
 void RpcStore::addToStore(const ValidPathInfo& info,
                           const ref<std::string>& nar, RepairFlag repair,
                           CheckSigsFlag checkSigs,
                           std::shared_ptr<FSAccessor> 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<std::string> 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