diff options
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 8 |
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); |