diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-04-08 12:34:27 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-04-08 12:34:27 -0600 |
commit | b8b8ec710160cfd343a8fce33ec8734e23c98444 (patch) | |
tree | 0595e07240c1497e00b7e6c41c3852cf4524bfd4 /src/libexpr/value-to-json.cc | |
parent | 1a93ac8133381eb692416c4e46b1706faa5cd89f (diff) |
move throw to preverve Error type; turn off debugger for tryEval
Diffstat (limited to 'src/libexpr/value-to-json.cc')
-rw-r--r-- | src/libexpr/value-to-json.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libexpr/value-to-json.cc b/src/libexpr/value-to-json.cc index d8bf73cd5..2f34feb1f 100644 --- a/src/libexpr/value-to-json.cc +++ b/src/libexpr/value-to-json.cc @@ -85,7 +85,8 @@ void printValueAsJSON(EvalState & state, bool strict, .errPos = v.determinePos(pos) }); e.addTrace(pos, hintfmt("message for the trace")); - state.debug_throw(e); + state.debugLastTrace(e); + throw e; } } @@ -99,7 +100,9 @@ void printValueAsJSON(EvalState & state, bool strict, void ExternalValueBase::printValueAsJSON(EvalState & state, bool strict, JSONPlaceholder & out, PathSet & context) const { - state.debug_throw(TypeError("cannot convert %1% to JSON", showType())); + auto e = TypeError("cannot convert %1% to JSON", showType()); + state.debugLastTrace(e); + throw e; } |