diff options
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index e15781404..bb3e6f3bd 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -812,14 +812,16 @@ void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr & } } -void EvalState::addErrorTrace(Error & e, const char * s, const std::string & s2) const +template<typename... Args> +void EvalState::addErrorTrace(Error & e, const Args & ... formatArgs) const { - e.addTrace(nullptr, s, s2); + e.addTrace(nullptr, HintFmt(formatArgs...)); } -void EvalState::addErrorTrace(Error & e, const PosIdx pos, const char * s, const std::string & s2, bool frame) const +template<typename... Args> +void EvalState::addErrorTrace(Error & e, const PosIdx pos, const Args & ... formatArgs) const { - e.addTrace(positions[pos], HintFmt(s, s2), frame); + e.addTrace(positions[pos], HintFmt(formatArgs...)); } template<typename... Args> @@ -1606,9 +1608,8 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value & "while calling %s", lambda.name ? concatStrings("'", symbols[lambda.name], "'") - : "anonymous lambda", - true); - if (pos) addErrorTrace(e, pos, "from call site%s", "", true); + : "anonymous lambda"); + if (pos) addErrorTrace(e, pos, "from call site"); } throw; } |