about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r--tvix/eval/src/builtins/mod.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 39e29580b4c3..a856538f0d8a 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -8,13 +8,26 @@ use std::{
     rc::Rc,
 };
 
-use crate::value::{Builtin, NixAttrs, NixString, Value};
+use crate::{
+    errors::ErrorKind,
+    value::{Builtin, NixAttrs, NixString, Value},
+};
 
 fn pure_builtins() -> Vec<Builtin> {
     vec![
+        Builtin::new("abort", 1, |mut args| {
+            return Err(
+                ErrorKind::Abort(args.pop().unwrap().to_string()?.as_str().to_owned()).into(),
+            );
+        }),
         Builtin::new("isNull", 1, |args| {
             Ok(Value::Bool(matches!(args[0], Value::Null)))
         }),
+        Builtin::new("throw", 1, |mut args| {
+            return Err(
+                ErrorKind::Throw(args.pop().unwrap().to_string()?.as_str().to_owned()).into(),
+            );
+        }),
         Builtin::new("toString", 1, |args| {
             // TODO: toString is actually not the same as Display
             Ok(Value::String(format!("{}", args[0]).into()))