about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-25T19·56+0300
committerflokli <flokli@flokli.de>2024-06-26T04·51+0000
commita0993e7304ce388aea19f79847815c6ea05fecc1 (patch)
tree2f34cd3a9bf7b7c6237370dbd89e5ff4ed8619fb
parent970e2a045bb051861f65b19d8ede144b271ecd4b (diff)
feat(tvix/eval): add ErrorKind::UnexpectedArgumentBuiltin r/8309
Change-Id: Ieb091b32aad566719fbe8604c4a589f5ccaaf6b3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11877
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
-rw-r--r--tvix/eval/src/errors.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs
index 1778fc3f1c3d..e32cfa04ed40 100644
--- a/tvix/eval/src/errors.rs
+++ b/tvix/eval/src/errors.rs
@@ -184,6 +184,9 @@ pub enum ErrorKind {
     /// Errors converting TOML to a value
     FromTomlError(String),
 
+    /// An unexpected argument was supplied to a builtin
+    UnexpectedArgumentBuiltin(NixString),
+
     /// An unexpected argument was supplied to a function that takes formal parameters
     UnexpectedArgumentFormals {
         arg: NixString,
@@ -487,6 +490,10 @@ to a missing value in the attribute set(s) included via `with`."#,
                 write!(f, "Error converting TOML to a Nix value: {msg}")
             }
 
+            ErrorKind::UnexpectedArgumentBuiltin(arg) => {
+                write!(f, "Unexpected agrument `{arg}` passed to builtin",)
+            }
+
             ErrorKind::UnexpectedArgumentFormals { arg, .. } => {
                 write!(f, "Unexpected argument `{arg}` supplied to function",)
             }
@@ -778,6 +785,7 @@ impl Error {
             ErrorKind::DuplicateAttrsKey { .. } => "in this attribute set",
             ErrorKind::InvalidAttributeName(_) => "in this attribute set",
             ErrorKind::RelativePathResolution(_) => "in this path literal",
+            ErrorKind::UnexpectedArgumentBuiltin { .. } => "while calling this builtin",
             ErrorKind::UnexpectedArgumentFormals { .. } => "in this function call",
             ErrorKind::UnexpectedContext => "in this string",
 
@@ -861,6 +869,7 @@ impl Error {
             ErrorKind::UnexpectedContext => "E037",
             ErrorKind::Utf8 => "E038",
             ErrorKind::UnknownHashType(_) => "E039",
+            ErrorKind::UnexpectedArgumentBuiltin { .. } => "E040",
 
             // Special error code for errors from other Tvix
             // components. We may want to introduce a code namespacing