about summary refs log tree commit diff
path: root/tvix/eval/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/errors.rs')
-rw-r--r--tvix/eval/src/errors.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs
index 086cc9d9052c..a84c931d0a4e 100644
--- a/tvix/eval/src/errors.rs
+++ b/tvix/eval/src/errors.rs
@@ -25,6 +25,11 @@ pub enum ErrorKind {
         name: String,
     },
 
+    // Attempted to index into a list beyond its boundaries.
+    IndexOutOfBounds {
+        index: usize,
+    },
+
     TypeError {
         expected: &'static str,
         actual: &'static str,
@@ -123,6 +128,10 @@ impl Error {
                 name
             ),
 
+            ErrorKind::IndexOutOfBounds { index } => {
+                format!("list index '{}' is out of bounds", index)
+            }
+
             ErrorKind::TypeError { expected, actual } => format!(
                 "expected value of type '{}', but found a '{}'",
                 expected, actual
@@ -208,6 +217,7 @@ to a missing value in the attribute set(s) included via `with`."#,
             ErrorKind::DuplicateAttrsKey { .. } => "E016",
             ErrorKind::ThunkForce(_) => "E017",
             ErrorKind::NotCoercibleToString { .. } => "E018",
+            ErrorKind::IndexOutOfBounds { .. } => "E019",
             ErrorKind::NotImplemented(_) => "E999",
         }
     }