mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
Better document error location indent
This commit is contained in:
parent
acf990c9ea
commit
5ef88457b8
1 changed files with 7 additions and 3 deletions
|
@ -180,20 +180,24 @@ void printCodeLines(std::ostream & out,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enough indent to align with with the `... `
|
||||||
|
// prepended to each element of the trace
|
||||||
|
#define ELLIPSIS_INDENT " "
|
||||||
|
|
||||||
void printAtPos(const ErrPos & pos, std::ostream & out)
|
void printAtPos(const ErrPos & pos, std::ostream & out)
|
||||||
{
|
{
|
||||||
if (pos) {
|
if (pos) {
|
||||||
switch (pos.origin) {
|
switch (pos.origin) {
|
||||||
case foFile: {
|
case foFile: {
|
||||||
out << fmt(ANSI_BLUE " at " ANSI_WARNING "%s:%s" ANSI_NORMAL ":", pos.file, showErrPos(pos));
|
out << fmt(ELLIPSIS_INDENT "at " ANSI_WARNING "%s:%s" ANSI_NORMAL ":", pos.file, showErrPos(pos));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case foString: {
|
case foString: {
|
||||||
out << fmt(ANSI_BLUE " at " ANSI_WARNING "«string»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
out << fmt(ELLIPSIS_INDENT "at " ANSI_WARNING "«string»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case foStdin: {
|
case foStdin: {
|
||||||
out << fmt(ANSI_BLUE " at " ANSI_WARNING "«stdin»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
out << fmt(ELLIPSIS_INDENT "at " ANSI_WARNING "«stdin»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue