addErrorContext
builtins.addErrorContext
Primop
Docs pulled from | This Revision | about 1 hour ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
- Write API documentation for this function
Learn how to write documentation
- Improve position tracking
Contribute to Noogle
Noogle detected
Detected Type
addErrorContext :: String -> a -> a
Implementation
This function is implemented in c++ and is part of the native nix runtime.
static void prim_addErrorContext(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{
try {
state.forceValue(*args[1], pos);
v = *args[1];
} catch (Error & e) {
NixStringContext context;
auto message = state
.coerceToString(
pos,
*args[0],
context,
"while evaluating the error message passed to builtins.addErrorContext",
false,
false)
.toOwned();
e.addTrace(nullptr, HintFmt(message), TracePrint::Always);
throw;
}
}