From ddea253ff8312bf1d2559999c4dd8d9cc3e5b240 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 20 Apr 2016 15:28:07 +0200 Subject: RemoteStore: Propagate InvalidPath exceptions from the daemon --- src/libstore/remote-store.cc | 13 ++++++++++++- src/libstore/worker-protocol.hh | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/libstore') 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 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(); info->path = path; info->deriver = readString(conn->from); diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index d62244d18c12..d133328d1e76 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -6,7 +6,7 @@ namespace nix { #define WORKER_MAGIC_1 0x6e697863 #define WORKER_MAGIC_2 0x6478696f -#define PROTOCOL_VERSION 0x110 +#define PROTOCOL_VERSION 0x111 #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00) #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff) -- cgit 1.4.1