Merge pull request #3447 from DavHau/improve-tofile-error-msg

improve toFile error message when containing potential drv path
This commit is contained in:
Domen Kožar 2020-04-11 13:12:11 +02:00 committed by GitHub
commit fc144242d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1020,7 +1020,9 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu
for (auto path : context) { for (auto path : context) {
if (path.at(0) != '/') if (path.at(0) != '/')
throw EvalError(format("in 'toFile': the file '%1%' cannot refer to derivation outputs, at %2%") % name % pos); throw EvalError(format(
"in 'toFile': the file named '%1%' must not contain a reference "
"to a derivation but contains (%2%), at %3%") % name % path % pos);
refs.insert(state.store->parseStorePath(path)); refs.insert(state.store->parseStorePath(path));
} }