about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-08-23T15·46+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-08-23T15·46+0000
commit38f18aa6d418515e42b688fa9b3e4f3ab61bb89e (patch)
tree3859e7778e44814cdb00f2693dd5778d0e0cb88e /src/libexpr/primops.cc
parent4a053bfdfd85915a2a659a337bd171bc22c49138 (diff)
* New primop: abort "error message".
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index bc4db2d81306..2bc5459d1306 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -629,6 +629,13 @@ static Expr primDependencyClosure(EvalState & state, const ATermVector & args)
 }
 
 
+static Expr primAbort(EvalState & state, const ATermVector & args)
+{
+    throw Abort(format("evaluation aborted with the following error message: %1%") %
+        evalString(state, args[0]));
+}
+
+
 /* Apply a function to every element of a list. */
 static Expr primMap(EvalState & state, const ATermVector & args)
 {
@@ -700,6 +707,7 @@ void EvalState::addPrimOps()
     addPrimOp("toString", 1, primToString);
     addPrimOp("isNull", 1, primIsNull);
     addPrimOp("dependencyClosure", 1, primDependencyClosure);
+    addPrimOp("abort", 1, primAbort);
 
     addPrimOp("map", 2, primMap);
     addPrimOp("removeAttrs", 2, primRemoveAttrs);