mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 23:42:43 +01:00
RemoteStore: Propagate InvalidPath exceptions from the daemon
This commit is contained in:
parent
c0c4ddcd9c
commit
ddea253ff8
3 changed files with 28 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue