aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2021-06-08 14:44:41 -0600
committerBen Burdette <bburdette@gmail.com>2021-06-08 14:44:41 -0600
commitff2e72054f741f51c07e737d82c8eff920342488 (patch)
tree6458fda6d91cb055e4135a5e2fb0c51a2711453e
parent99304334caa833b32712ad02e04f1a0e9c8322fe (diff)
another throwTypeError form
-rw-r--r--src/libexpr/eval.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 9bb43f522..f296550d0 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -743,6 +743,19 @@ LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const
throw error;
}
+LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const char * t, valmap * env))
+{
+ auto delenv = std::unique_ptr<valmap>(env);
+ auto error = TypeError({
+ .msg = hintfmt(s, t),
+ .errPos = pos
+ });
+
+ if (debuggerHook)
+ debuggerHook(error, *env);
+ throw error;
+}
+
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const ExprLambda & fun, const Symbol & s2, valmap * env))
{
auto delenv = std::unique_ptr<valmap>(env);
@@ -1378,7 +1391,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & po
throwTypeError(
pos,
"attempt to call something which is not a function but %1%",
- showType(fun),
+ showType(fun).c_str(),
map2("fun", &fun, "arg", &arg));
}