From ff2e72054f741f51c07e737d82c8eff920342488 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 8 Jun 2021 14:44:41 -0600 Subject: [PATCH] another throwTypeError form --- src/libexpr/eval.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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(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(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)); }