about summary refs log tree commit diff
path: root/src/nix-daemon/nix-daemon.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-20T13·28+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-20T13·28+0200
commitddea253ff8312bf1d2559999c4dd8d9cc3e5b240 (patch)
tree5b2a0e8bdbaddcbab0b2f8124983d52577128d63 /src/nix-daemon/nix-daemon.cc
parentc0c4ddcd9c19a29e3dfd26160929f3278150547f (diff)
RemoteStore: Propagate InvalidPath exceptions from the daemon
Diffstat (limited to 'src/nix-daemon/nix-daemon.cc')
-rw-r--r--src/nix-daemon/nix-daemon.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index dfb5da4ad527..efc67b6a8755 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -495,15 +495,23 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
 
     case wopQueryPathInfo: {
         Path path = readStorePath(from);
+        std::shared_ptr<const ValidPathInfo> info;
         startWork();
-        auto info = store->queryPathInfo(path);
-        stopWork();
-        to << info->deriver << printHash(info->narHash) << info->references
-           << info->registrationTime << info->narSize;
-        if (GET_PROTOCOL_MINOR(clientVersion) >= 16) {
-            to << info->ultimate
-               << info->sigs;
+        try {
+            info = store->queryPathInfo(path);
+        } catch (InvalidPath &) {
+            if (GET_PROTOCOL_MINOR(clientVersion) < 17) throw;
         }
+        stopWork();
+        if (info) {
+            to << 1 << info->deriver << printHash(info->narHash) << info->references
+               << info->registrationTime << info->narSize;
+            if (GET_PROTOCOL_MINOR(clientVersion) >= 16) {
+                to << info->ultimate
+                   << info->sigs;
+            }
+        } else
+            to << 0;
         break;
     }