aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval-inline.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval-inline.hh')
-rw-r--r--src/libexpr/eval-inline.hh22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh
index 942cda1ea..3d544c903 100644
--- a/src/libexpr/eval-inline.hh
+++ b/src/libexpr/eval-inline.hh
@@ -7,20 +7,26 @@
namespace nix {
-LocalNoInlineNoReturn(void throwEvalError(const char * s, const Pos & pos))
+LocalNoInlineNoReturn(void throwEvalError(const Pos & pos, const char * s))
{
- throw EvalError(format(s) % pos);
+ throw EvalError({
+ .hint = hintfmt(s),
+ .nixCode = NixCode { .errPos = pos }
+ });
}
LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v))
{
- throw TypeError(format(s) % showType(v));
+ throw TypeError(s, showType(v));
}
-LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v, const Pos & pos))
+LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v))
{
- throw TypeError(format(s) % showType(v) % pos);
+ throw TypeError({
+ .hint = hintfmt(s, showType(v)),
+ .nixCode = NixCode { .errPos = pos }
+ });
}
@@ -43,7 +49,7 @@ void EvalState::forceValue(Value & v, const Pos & pos)
else if (v.type == tApp)
callFunction(*v.app.left, *v.app.right, v, noPos);
else if (v.type == tBlackhole)
- throwEvalError("infinite recursion encountered, at %1%", pos);
+ throwEvalError(pos, "infinite recursion encountered");
}
@@ -59,7 +65,7 @@ inline void EvalState::forceAttrs(Value & v, const Pos & pos)
{
forceValue(v, pos);
if (v.type != tAttrs)
- throwTypeError("value is %1% while a set was expected, at %2%", v, pos);
+ throwTypeError(pos, "value is %1% while a set was expected", v);
}
@@ -75,7 +81,7 @@ inline void EvalState::forceList(Value & v, const Pos & pos)
{
forceValue(v, pos);
if (!v.isList())
- throwTypeError("value is %1% while a list was expected, at %2%", v, pos);
+ throwTypeError(pos, "value is %1% while a list was expected", v);
}
/* Note: Various places expect the allocated memory to be zeroed. */