mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-31 23:46:48 +02:00
traces: Do not print unknown location
Solves 1/3 of the infinite recursion at unknown location meme. See #8879 for ensuring we always have a trace (for stack overflows) We might want to re-add this for finding missing location info *while hacking on that problem only*.
This commit is contained in:
parent
4a8c9bb9aa
commit
4c50f5d130
7 changed files with 11 additions and 20 deletions
|
@ -203,8 +203,6 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|
||||||
auto noSource = ANSI_ITALIC " (source not available)" ANSI_NORMAL "\n";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Traces
|
* Traces
|
||||||
* ------
|
* ------
|
||||||
|
@ -320,7 +318,7 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
||||||
|
|
||||||
oss << "\n" << "… " << trace.hint.str() << "\n";
|
oss << "\n" << "… " << trace.hint.str() << "\n";
|
||||||
|
|
||||||
if (trace.pos) {
|
if (trace.pos && *trace.pos) {
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
oss << "\n" << ellipsisIndent << ANSI_BLUE << "at " ANSI_WARNING << *trace.pos << ANSI_NORMAL << ":";
|
oss << "\n" << ellipsisIndent << ANSI_BLUE << "at " ANSI_WARNING << *trace.pos << ANSI_NORMAL << ":";
|
||||||
|
@ -329,8 +327,7 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
||||||
oss << "\n";
|
oss << "\n";
|
||||||
printCodeLines(oss, "", *trace.pos, *loc);
|
printCodeLines(oss, "", *trace.pos, *loc);
|
||||||
oss << "\n";
|
oss << "\n";
|
||||||
} else
|
}
|
||||||
oss << noSource;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oss << "\n" << prefix;
|
oss << "\n" << prefix;
|
||||||
|
@ -338,15 +335,14 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
||||||
|
|
||||||
oss << einfo.msg << "\n";
|
oss << einfo.msg << "\n";
|
||||||
|
|
||||||
if (einfo.errPos) {
|
if (einfo.errPos && *einfo.errPos) {
|
||||||
oss << "\n" << ANSI_BLUE << "at " ANSI_WARNING << *einfo.errPos << ANSI_NORMAL << ":";
|
oss << "\n" << ANSI_BLUE << "at " ANSI_WARNING << *einfo.errPos << ANSI_NORMAL << ":";
|
||||||
|
|
||||||
if (auto loc = einfo.errPos->getCodeLines()) {
|
if (auto loc = einfo.errPos->getCodeLines()) {
|
||||||
oss << "\n";
|
oss << "\n";
|
||||||
printCodeLines(oss, "", *einfo.errPos, *loc);
|
printCodeLines(oss, "", *einfo.errPos, *loc);
|
||||||
oss << "\n";
|
oss << "\n";
|
||||||
} else
|
}
|
||||||
oss << noSource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto suggestions = einfo.suggestions.trim();
|
auto suggestions = einfo.suggestions.trim();
|
||||||
|
|
|
@ -70,6 +70,13 @@ struct AbstractPos
|
||||||
uint32_t line = 0;
|
uint32_t line = 0;
|
||||||
uint32_t column = 0;
|
uint32_t column = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An AbstractPos may be a "null object", representing an unknown position.
|
||||||
|
*
|
||||||
|
* Return true if this position is known.
|
||||||
|
*/
|
||||||
|
inline operator bool() const { return line != 0; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the contents of the source file.
|
* Return the contents of the source file.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,5 +8,3 @@ error:
|
||||||
2| key = "value"
|
2| key = "value"
|
||||||
|
|
||||||
error: while parsing a TOML string: Dates and times are not supported
|
error: while parsing a TOML string: Dates and times are not supported
|
||||||
|
|
||||||
at «none»:0: (source not available)
|
|
||||||
|
|
|
@ -10,10 +10,6 @@ error:
|
||||||
|
|
||||||
… while evaluating the first argument passed to builtins.toString
|
… while evaluating the first argument passed to builtins.toString
|
||||||
|
|
||||||
at «none»:0: (source not available)
|
|
||||||
|
|
||||||
… while calling the 'hashFile' builtin
|
… while calling the 'hashFile' builtin
|
||||||
|
|
||||||
at «none»:0: (source not available)
|
|
||||||
|
|
||||||
error: opening file '/pwd/lang/this-file-is-definitely-not-there-7392097': No such file or directory
|
error: opening file '/pwd/lang/this-file-is-definitely-not-there-7392097': No such file or directory
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
error:
|
error:
|
||||||
… while evaluating the `__overrides` attribute
|
… while evaluating the `__overrides` attribute
|
||||||
|
|
||||||
at «none»:0: (source not available)
|
|
||||||
|
|
||||||
error: value is an integer while a set was expected
|
error: value is an integer while a set was expected
|
||||||
|
|
|
@ -8,5 +8,3 @@ error:
|
||||||
2|
|
2|
|
||||||
|
|
||||||
error: negative start position in 'substring'
|
error: negative start position in 'substring'
|
||||||
|
|
||||||
at «none»:0: (source not available)
|
|
||||||
|
|
|
@ -9,6 +9,4 @@ error:
|
||||||
|
|
||||||
… while evaluating the first argument passed to builtins.toPath
|
… while evaluating the first argument passed to builtins.toPath
|
||||||
|
|
||||||
at «none»:0: (source not available)
|
|
||||||
|
|
||||||
error: string 'foo/bar' doesn't represent an absolute path
|
error: string 'foo/bar' doesn't represent an absolute path
|
||||||
|
|
Loading…
Reference in a new issue