diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-05-08 18:18:28 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-05-08 18:18:28 -0600 |
commit | 55eb71714854b262b5e1079ff250a13cc0bbf644 (patch) | |
tree | 576767e919ac461b15ce11671a285d3933e15129 /src/libexpr/eval-inline.hh | |
parent | 1b801cec407454b904466153dfc56cec6b433f4b (diff) |
add pos to errorinfo, remove from hints
Diffstat (limited to 'src/libexpr/eval-inline.hh')
-rw-r--r-- | src/libexpr/eval-inline.hh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh index 4d82ccf09..d03633cc7 100644 --- a/src/libexpr/eval-inline.hh +++ b/src/libexpr/eval-inline.hh @@ -9,7 +9,11 @@ namespace nix { LocalNoInlineNoReturn(void throwEvalError(const char * s, const Pos & pos)) { - throw EvalError(s, pos); + throw EvalError( + ErrorInfo { + .hint = hintfmt(s), + .nixCode = NixCode { .errPos = pos } + }); } LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v)) @@ -20,7 +24,11 @@ LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v)) LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v, const Pos & pos)) { - throw TypeError(s, showType(v), pos); + throw TypeError( + ErrorInfo { + .hint = hintfmt(s, showType(v)), + .nixCode = NixCode { .errPos = pos } + }); } @@ -43,7 +51,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("infinite recursion encountered", pos); } @@ -59,7 +67,7 @@ inline void EvalState::forceAttrs(Value & v, const Pos & pos) { forceValue(v); if (v.type != tAttrs) - throwTypeError("value is %1% while a set was expected, at %2%", v, pos); + throwTypeError("value is %1% while a set was expected", v, pos); } @@ -75,7 +83,7 @@ inline void EvalState::forceList(Value & v, const Pos & pos) { forceValue(v); if (!v.isList()) - throwTypeError("value is %1% while a list was expected, at %2%", v, pos); + throwTypeError("value is %1% while a list was expected", v, pos); } /* Note: Various places expect the allocated memory to be zeroed. */ |