aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@protonmail.com>2022-02-14 14:04:34 -0700
committerBen Burdette <bburdette@protonmail.com>2022-02-14 14:04:34 -0700
commite761bf0601a56db26c31891a3433c1319814fffa (patch)
treec750c81b0d3db455ec658687772e35005221cdcf /src/libexpr/primops.cc
parent4cffb130e385bc3f4c5ca0482ad8c4dd22229cfe (diff)
make an 'info' level error on break
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 956c55e49..25845bdc4 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -699,6 +699,7 @@ static RegisterPrimOp primop_genericClosure(RegisterPrimOp::Info {
.fun = prim_genericClosure,
});
+
static RegisterPrimOp primop_break({
.name = "break",
.args = {"v"},
@@ -707,17 +708,15 @@ static RegisterPrimOp primop_break({
)",
.fun = [](EvalState & state, const Pos & pos, Value * * args, Value & v)
{
- std::cout << "primop_break, value: " << *args[0] << std::endl;
- // PathSet context;
- // string s = state.coerceToString(pos, *args[0], context);
+ auto error = Error(ErrorInfo{
+ .level = lvlInfo,
+ .msg = hintfmt("breakpoint reached; value was %1%", *args[0]),
+ .errPos = pos,
+ });
if (debuggerHook && !state.debugTraces.empty())
{
auto &dt = state.debugTraces.front();
- // std::optional<ErrPos> pos;
- // const Expr &expr;
- // const Env &env;
- // hintformat hint;
- debuggerHook(nullptr, dt.env, dt.expr);
+ debuggerHook(&error, dt.env, dt.expr);
// returning the value we were passed.
v = *args[0];