mirror of
https://github.com/NixOS/nix
synced 2025-06-26 11:41:15 +02:00
Implement a suggestions mechanism
Each `Error` class now includes a set of suggestions, and these are printed by the top-level handler.
This commit is contained in:
parent
b09baf690b
commit
c0792b1546
7 changed files with 191 additions and 6 deletions
|
@ -282,6 +282,13 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
|||
}
|
||||
}
|
||||
|
||||
auto suggestions = einfo.suggestions.trim();
|
||||
if (! suggestions.suggestions.empty()){
|
||||
oss << "Did you mean " <<
|
||||
suggestions.trim().pretty_print() <<
|
||||
"?" << std::endl;
|
||||
}
|
||||
|
||||
// traces
|
||||
if (showTrace && !einfo.traces.empty()) {
|
||||
for (auto iter = einfo.traces.rbegin(); iter != einfo.traces.rend(); ++iter) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue