aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-07-01 11:49:01 -0600
committerBen Burdette <bburdette@gmail.com>2020-07-01 11:49:01 -0600
commit3629b0585aaf13f7d25510c55ca06611cb2135af (patch)
tree08cdcfc1e9591cce6e7f1395d452bddcf2d87a6d /src/libutil
parent2a39c083dca8f672c695898d56cf62081ac79eca (diff)
don't include errpos for addErrorContext
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/error.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc
index 78e2a5ea2..3a9b924f2 100644
--- a/src/libutil/error.cc
+++ b/src/libutil/error.cc
@@ -305,7 +305,7 @@ std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool show
nl = true;
}
- if (einfo.errPos.has_value()) {
+ if (einfo.errPos.has_value() && (*einfo.errPos)) {
auto loc = getCodeLines(*einfo.errPos);
// lines of code.
@@ -359,9 +359,10 @@ std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool show
out << ANSI_BLUE << "trace: " << ANSI_NORMAL << iter->hint.str();
nl = true;
- auto pos = *iter->pos;
- if (pos) {
+ if (*iter->pos) {
+ auto pos = iter->pos.value();
out << std::endl << prefix;
+
printAtPos(prefix, pos, out);
auto loc = getCodeLines(pos);
if (loc.has_value())