From ed74eaa07f6f7b5e87a1b96eff94990551ff488e Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 14 May 2021 11:09:18 -0600 Subject: [PATCH] throwEvalError form 3 --- src/libexpr/eval.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 1ae88ea1f..592f89fdf 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -694,12 +694,17 @@ LocalNoInlineNoReturn(void throwEvalError(const char * s, const string & s2, con throw error; } -LocalNoInlineNoReturn(void throwEvalError(const Pos & pos, const char * s, const string & s2, const string & s3)) +LocalNoInlineNoReturn(void throwEvalError(const Pos & pos, const char * s, const string & s2, const string & s3, valmap * env)) { - throw EvalError({ + auto delenv = std::unique_ptr(env); + auto error = EvalError({ .msg = hintfmt(s, s2, s3), .errPos = pos }); + + if (debuggerHook) + debuggerHook(error, *env); + throw error; } LocalNoInlineNoReturn(void throwEvalError(const Pos & p1, const char * s, const Symbol & sym, const Pos & p2)) @@ -1855,7 +1860,7 @@ string EvalState::forceStringNoCtx(Value & v, const Pos & pos) if (v.string.context) { if (pos) throwEvalError(pos, "the string '%1%' is not allowed to refer to a store path (such as '%2%')", - v.string.s, v.string.context[0]); + v.string.s, v.string.context[0], map1("value", &v)); else throwEvalError("the string '%1%' is not allowed to refer to a store path (such as '%2%')", v.string.s, v.string.context[0], map1("value", &v));