mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Remove trace item: while calling the 'addErrorContext' builtin
This commit is contained in:
parent
bebacc475c
commit
981c309057
4 changed files with 13 additions and 16 deletions
|
@ -1665,7 +1665,8 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
try {
|
try {
|
||||||
fn->fun(*this, vCur.determinePos(noPos), args, vCur);
|
fn->fun(*this, vCur.determinePos(noPos), args, vCur);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
addErrorTrace(e, pos, "while calling the '%1%' builtin", fn->name);
|
if (fn->addTrace)
|
||||||
|
addErrorTrace(e, pos, "while calling the '%1%' builtin", fn->name);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1713,7 +1714,8 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
// so the debugger allows to inspect the wrong parameters passed to the builtin.
|
// so the debugger allows to inspect the wrong parameters passed to the builtin.
|
||||||
fn->fun(*this, vCur.determinePos(noPos), vArgs, vCur);
|
fn->fun(*this, vCur.determinePos(noPos), vArgs, vCur);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
addErrorTrace(e, pos, "while calling the '%1%' builtin", fn->name);
|
if (fn->addTrace)
|
||||||
|
addErrorTrace(e, pos, "while calling the '%1%' builtin", fn->name);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,13 @@ struct PrimOp
|
||||||
*/
|
*/
|
||||||
const char * doc = nullptr;
|
const char * doc = nullptr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a trace item, `while calling the '<name>' builtin`
|
||||||
|
*
|
||||||
|
* This is used to remove the redundant item for `builtins.addErrorContext`.
|
||||||
|
*/
|
||||||
|
bool addTrace = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the primop.
|
* Implementation of the primop.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -834,6 +834,8 @@ static void prim_addErrorContext(EvalState & state, const PosIdx pos, Value * *
|
||||||
static RegisterPrimOp primop_addErrorContext(PrimOp {
|
static RegisterPrimOp primop_addErrorContext(PrimOp {
|
||||||
.name = "__addErrorContext",
|
.name = "__addErrorContext",
|
||||||
.arity = 2,
|
.arity = 2,
|
||||||
|
// The normal trace item is redundant
|
||||||
|
.addTrace = false,
|
||||||
.fun = prim_addErrorContext,
|
.fun = prim_addErrorContext,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
error:
|
error:
|
||||||
… while calling the 'addErrorContext' builtin
|
|
||||||
at /pwd/lang/eval-fail-addErrorContext-example.nix:6:7:
|
|
||||||
5| else
|
|
||||||
6| builtins.addErrorContext
|
|
||||||
| ^
|
|
||||||
7| "while counting down; n = ${toString n}"
|
|
||||||
|
|
||||||
… while counting down; n = 10
|
… while counting down; n = 10
|
||||||
|
|
||||||
… while calling the 'addErrorContext' builtin
|
|
||||||
at /pwd/lang/eval-fail-addErrorContext-example.nix:6:7:
|
|
||||||
5| else
|
|
||||||
6| builtins.addErrorContext
|
|
||||||
| ^
|
|
||||||
7| "while counting down; n = ${toString n}"
|
|
||||||
|
|
||||||
… while counting down; n = 9
|
… while counting down; n = 9
|
||||||
|
|
||||||
… while counting down; n = 8
|
… while counting down; n = 8
|
||||||
|
|
Loading…
Reference in a new issue