1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 15:51:15 +02:00

Always print addErrorContext traces

This commit is contained in:
Robert Hensing 2024-03-23 23:56:05 +01:00
parent 38ba96d7b0
commit bebacc475c
7 changed files with 90 additions and 17 deletions

View file

@ -61,9 +61,16 @@ void printCodeLines(std::ostream & out,
const Pos & errPos,
const LinesOfCode & loc);
enum struct TraceKind {
Other,
/** Produced by builtins.addErrorContext. Always printed. */
Custom,
};
struct Trace {
std::shared_ptr<Pos> pos;
HintFmt hint;
TraceKind kind = TraceKind::Other;
};
inline bool operator<(const Trace& lhs, const Trace& rhs);
@ -161,7 +168,7 @@ public:
addTrace(std::move(e), HintFmt(std::string(fs), args...));
}
void addTrace(std::shared_ptr<Pos> && e, HintFmt hint);
void addTrace(std::shared_ptr<Pos> && e, HintFmt hint, TraceKind kind = TraceKind::Other);
bool hasTrace() const { return !err.traces.empty(); }