aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Maudoux <guillaume.maudoux@tweag.io>2022-04-28 13:00:24 +0200
committerGuillaume Maudoux <guillaume.maudoux@tweag.io>2022-04-28 13:00:24 +0200
commit5ef88457b8bdef957fcbb3cd0e7740595fad1949 (patch)
tree5fc694528604493f1c4f47e2cb131004a3fcbd0c
parentacf990c9ea9de913a500cf2b7a7492eef3bcd7b5 (diff)
Better document error location indent
-rw-r--r--src/libutil/error.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc
index c66dfa112..7dc8c1941 100644
--- a/src/libutil/error.cc
+++ b/src/libutil/error.cc
@@ -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)
{
if (pos) {
switch (pos.origin) {
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;
}
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;
}
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;
}
default: