printValue: Show assertion errors inline
This commit is contained in:
parent
e587aec123
commit
8e765b8876
1 changed files with 18 additions and 6 deletions
22
nix-repl.cc
22
nix-repl.cc
|
@ -390,13 +390,20 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Sorted::iterator, i, sorted)
|
foreach (Sorted::iterator, i, sorted) {
|
||||||
|
str << i->first << " = ";
|
||||||
if (hidden.find(i->first) != hidden.end())
|
if (hidden.find(i->first) != hidden.end())
|
||||||
str << i->first << " = «...»; ";
|
str << "«...»";
|
||||||
else if (seen.find(i->second) != seen.end())
|
else if (seen.find(i->second) != seen.end())
|
||||||
str << i->first << " = «repeated»; ";
|
str << "«repeated»";
|
||||||
else
|
else
|
||||||
printValue(str << i->first << " = ", *i->second, maxDepth - 1, seen) << "; ";
|
try {
|
||||||
|
printValue(str, *i->second, maxDepth - 1, seen);
|
||||||
|
} catch (AssertionError & e) {
|
||||||
|
str << "«error: " << e.msg() << "»";
|
||||||
|
}
|
||||||
|
str << "; ";
|
||||||
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
str << "... ";
|
str << "... ";
|
||||||
|
@ -415,7 +422,12 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
||||||
if (seen.find(v.list.elems[n]) != seen.end())
|
if (seen.find(v.list.elems[n]) != seen.end())
|
||||||
str << "«repeated»";
|
str << "«repeated»";
|
||||||
else
|
else
|
||||||
printValue(str, *v.list.elems[n], maxDepth - 1, seen) << " ";
|
try {
|
||||||
|
printValue(str, *v.list.elems[n], maxDepth - 1, seen);
|
||||||
|
} catch (AssertionError & e) {
|
||||||
|
str << "«error: " << e.msg() << "»";
|
||||||
|
}
|
||||||
|
str << " ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
str << "... ";
|
str << "... ";
|
||||||
|
|
Loading…
Reference in a new issue