mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
Merge pull request #4351 from Ma27/json-errtrace
primops/fromJSON: add error position in case of parse error
This commit is contained in:
commit
27b5ff354e
1 changed files with 6 additions and 1 deletions
|
@ -1621,7 +1621,12 @@ static RegisterPrimOp primop_toJSON({
|
||||||
static void prim_fromJSON(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
static void prim_fromJSON(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
string s = state.forceStringNoCtx(*args[0], pos);
|
string s = state.forceStringNoCtx(*args[0], pos);
|
||||||
parseJSON(state, s, v);
|
try {
|
||||||
|
parseJSON(state, s, v);
|
||||||
|
} catch (JSONParseError &e) {
|
||||||
|
e.addTrace(pos, "while decoding a JSON string");
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPrimOp primop_fromJSON({
|
static RegisterPrimOp primop_fromJSON({
|
||||||
|
|
Loading…
Reference in a new issue