don't include errpos for addErrorContext
This commit is contained in:
parent
2a39c083dc
commit
3629b0585a
|
@ -471,8 +471,7 @@ static void prim_addErrorContext(EvalState & state, const Pos & pos, Value * * a
|
||||||
v = *args[1];
|
v = *args[1];
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
PathSet context;
|
PathSet context;
|
||||||
// TODO: is this right, include this pos?? Test it. esp with LOC.
|
e.addTrace(std::nullopt, state.coerceToString(pos, *args[0], context));
|
||||||
e.addTrace(pos, "%1%", state.coerceToString(pos, *args[0], context));
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool show
|
||||||
nl = true;
|
nl = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (einfo.errPos.has_value()) {
|
if (einfo.errPos.has_value() && (*einfo.errPos)) {
|
||||||
auto loc = getCodeLines(*einfo.errPos);
|
auto loc = getCodeLines(*einfo.errPos);
|
||||||
|
|
||||||
// lines of code.
|
// lines of code.
|
||||||
|
@ -359,9 +359,10 @@ std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool show
|
||||||
out << ANSI_BLUE << "trace: " << ANSI_NORMAL << iter->hint.str();
|
out << ANSI_BLUE << "trace: " << ANSI_NORMAL << iter->hint.str();
|
||||||
|
|
||||||
nl = true;
|
nl = true;
|
||||||
auto pos = *iter->pos;
|
if (*iter->pos) {
|
||||||
if (pos) {
|
auto pos = iter->pos.value();
|
||||||
out << std::endl << prefix;
|
out << std::endl << prefix;
|
||||||
|
|
||||||
printAtPos(prefix, pos, out);
|
printAtPos(prefix, pos, out);
|
||||||
auto loc = getCodeLines(pos);
|
auto loc = getCodeLines(pos);
|
||||||
if (loc.has_value())
|
if (loc.has_value())
|
||||||
|
|
Loading…
Reference in a new issue