1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 17:51:15 +02:00

RemoteStore: Propagate InvalidPath exceptions from the daemon

This commit is contained in:
Eelco Dolstra 2016-04-20 15:28:07 +02:00
parent c0c4ddcd9c
commit ddea253ff8
3 changed files with 28 additions and 9 deletions

View file

@ -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;
}