query
On this page

abort

builtins.abort

Primop
Docs pulled from | This Revision | about 4 hours ago


Nix manual

Takes 1 arguments

s

Abort Nix expression evaluation and print the error message s.

Noogle detected

Detected Type
abort :: String -> Never

Implementation

This function is implemented in c++ and is part of the native nix runtime.

src/libexpr/primops.cc:988

static RegisterPrimOp primop_abort(
    {.name = "abort",
     .args = {"s"},
     .doc = R"(
      Abort Nix expression evaluation and print the error message *s*.
    )",
     .impl = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
         NixStringContext context;
         auto s =
             state.coerceToString(pos, *args[0], context, "while evaluating the error message passed to builtins.abort")
                 .toOwned();
         state.error<Abort>("evaluation aborted with the following error message: '%1%'", s)
             .setIsFromExpr()
             .debugThrow();
     }})