From 96dbf4d68680b7bdf9fc51e061b87d8872870c8c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 14 Sep 2020 18:04:14 -0400 Subject: fix(tvix): Convert INVALID_ARGUMENT to InvalidPath The code that calls queryPathInfoUncached explicitly catches the InvalidPath exception and translates it into a null result - but the RPC code was throwing a regular old Error for invalid paths. At some point we should get rid of all the exception-driven control flow in this whole thing, but in the meantime this gets us back to functional. Change-Id: I2a38790ee0c691ab0c8394c7738d7693fa42aa10 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1980 Tested-by: BuildkiteCI Reviewed-by: kanepyork --- third_party/nix/src/libstore/rpc-store.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'third_party/nix/src/libstore') diff --git a/third_party/nix/src/libstore/rpc-store.cc b/third_party/nix/src/libstore/rpc-store.cc index 02975341fd40..993d111e8616 100644 --- a/third_party/nix/src/libstore/rpc-store.cc +++ b/third_party/nix/src/libstore/rpc-store.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -135,8 +136,11 @@ void RpcStore::queryPathInfoUncached( try { proto::PathInfo path_info; - SuccessOrThrow(stub_->QueryPathInfo(&ctx, store_path, &path_info), - __FUNCTION__); + auto result = stub_->QueryPathInfo(&ctx, store_path, &path_info); + if (result.error_code() == grpc::INVALID_ARGUMENT) { + throw InvalidPath(absl::StrFormat("path '%s' is not valid", path)); + } + SuccessOrThrow(result); std::shared_ptr info; -- cgit 1.4.1