Improve error message when an argument is not a flake

This commit is contained in:
Eelco Dolstra 2020-04-27 18:55:20 +02:00
parent b4e23dcd9e
commit b51dff431c

View file

@ -468,7 +468,10 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
if (s.find('/') != std::string::npos && (storePath = follow(s))) if (s.find('/') != std::string::npos && (storePath = follow(s)))
result.push_back(std::make_shared<InstallableStorePath>(store, store->printStorePath(*storePath))); result.push_back(std::make_shared<InstallableStorePath>(store, store->printStorePath(*storePath)));
else else
throw Error("unrecognized argument '%s'", s); throw Error(
pathExists(s)
? "path '%s' is not a flake or a store path"
: "don't know how to handle argument '%s'", s);
} }
} }
} }