aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorjulia <midnight@trainwit.ch>2024-06-16 04:29:13 +0000
committerGerrit Code Review <gerrit@localhost>2024-06-16 04:29:13 +0000
commitdd70044cde0bee5cd66fca6347e294f6c7724001 (patch)
tree3327a2512e287fdffd94fd5b26d3bb51ee73fc11 /src/libexpr
parentb4035ed1d19a2a77a775a65c3c7af125007dae2a (diff)
parent89c782b0c0df6ca9d85207b62318e70729f18e24 (diff)
Merge changes I07d2da41,I864d7340,I86612c64 into main
* changes: Change error messages about 'invalid paths' to 'path does not exist'. Add a clearer error message for InvalidPathError during evaluation Harmonise the Store::queryPathInfoUncached interface
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval-error.hh6
-rw-r--r--src/libexpr/primops.cc3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/libexpr/eval-error.hh b/src/libexpr/eval-error.hh
index 4f0e0d24c..19540d612 100644
--- a/src/libexpr/eval-error.hh
+++ b/src/libexpr/eval-error.hh
@@ -47,12 +47,16 @@ MakeError(MissingArgumentError, EvalError);
MakeError(RestrictedPathError, Error);
MakeError(InfiniteRecursionError, EvalError);
+/**
+ * Represents an exception due to an invalid path; that is, it does not exist.
+ * It corresponds to `!Store::validPath()`.
+ */
struct InvalidPathError : public EvalError
{
public:
Path path;
InvalidPathError(EvalState & state, const Path & path)
- : EvalError(state, "path '%s' is not valid", path)
+ : EvalError(state, "path '%s' did not exist in the store during evaluation", path)
{
}
};
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 3cc2659fb..dba56c011 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -383,7 +383,8 @@ void prim_exec(EvalState & state, const PosIdx pos, Value * * args, Value & v)
try {
auto _ = state.realiseContext(context); // FIXME: Handle CA derivations
} catch (InvalidPathError & e) {
- state.error<EvalError>("cannot execute '%1%', since path '%2%' is not valid", program, e.path).atPos(pos).debugThrow();
+ e.addTrace(state.positions[pos], "while realising the context for builtins.exec");
+ throw;
}
auto output = runProgram(program, true, commandArgs);