about summary refs log tree commit diff
path: root/tvix/eval/src/errors.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-23T14·11+0300
committertazjin <tazjin@tvl.su>2022-09-28T00·00+0000
commit846215ae2b924dc1de5cf8f3873402b3334917c3 (patch)
tree48c66eabf1956d1e3bdd66c079f474836c48183b /tvix/eval/src/errors.rs
parent71a8db108d94f68f6e411d36a36d4f3045987ac7 (diff)
refactor(tvix/eval): generalise error variant for dynamic keys r/4973
Change-Id: I08f40b4b53652a519e76d6e8344c7c3fe10a0689
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6767
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/errors.rs')
-rw-r--r--tvix/eval/src/errors.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs
index 83496b59df33..7ec43abb85a9 100644
--- a/tvix/eval/src/errors.rs
+++ b/tvix/eval/src/errors.rs
@@ -47,8 +47,8 @@ pub enum ErrorKind {
     /// Resolving a user-supplied path literal failed in some way.
     PathResolution(String),
 
-    /// Dynamic keys are not allowed in let.
-    DynamicKeyInLet,
+    /// Dynamic keys are not allowed in some scopes.
+    DynamicKeyInScope(&'static str),
 
     /// Unknown variable in statically known scope.
     UnknownStaticVariable,
@@ -175,8 +175,8 @@ impl Error {
 
             ErrorKind::PathResolution(err) => format!("could not resolve path: {}", err),
 
-            ErrorKind::DynamicKeyInLet => {
-                "dynamically evaluated keys are not allowed in let-bindings".to_string()
+            ErrorKind::DynamicKeyInScope(scope) => {
+                format!("dynamically evaluated keys are not allowed in {}", scope)
             }
 
             ErrorKind::UnknownStaticVariable => "variable not found".to_string(),
@@ -260,7 +260,7 @@ to a missing value in the attribute set(s) included via `with`."#,
             ErrorKind::TypeError { .. } => "E006",
             ErrorKind::Incomparable { .. } => "E007",
             ErrorKind::PathResolution(_) => "E008",
-            ErrorKind::DynamicKeyInLet => "E009",
+            ErrorKind::DynamicKeyInScope(_) => "E009",
             ErrorKind::UnknownStaticVariable => "E010",
             ErrorKind::UnknownDynamicVariable(_) => "E011",
             ErrorKind::VariableAlreadyDefined(_) => "E012",