about summary refs log tree commit diff
path: root/src/libstore/remote-store.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/libstore/remote-store.cc
parentc0c4ddcd9c19a29e3dfd26160929f3278150547f (diff)
RemoteStore: Propagate InvalidPath exceptions from the daemon
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r--src/libstore/remote-store.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 430d0ecf1143..1edf3662e8b8 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -243,7 +243,18 @@ std::shared_ptr<ValidPathInfo> RemoteStore::queryPathInfoUncached(const Path & p
 {
     auto conn(connections->get());
     conn->to << wopQueryPathInfo << path;
-    conn->processStderr();
+    try {
+        conn->processStderr();
+    } catch (Error & e) {
+        // Ugly backwards compatibility hack.
+        if (e.msg().find("is not valid") != std::string::npos)
+            throw InvalidPath(e.what());
+        throw;
+    }
+    if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 17) {
+        bool valid = readInt(conn->from) != 0;
+        if (!valid) throw InvalidPath(format("path ‘%s’ is not valid") % path);
+    }
     auto info = std::make_shared<ValidPathInfo>();
     info->path = path;
     info->deriver = readString(conn->from);