aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-07-01 12:02:02 -0600
committerBen Burdette <bburdette@gmail.com>2020-07-01 12:02:02 -0600
commita295b2ea96c1cee263147a7d1b1b937d63e954af (patch)
tree77dd4fb12499c31808003ca8baac1f9f1a0c4da8 /src/libutil/error.cc
parent3629b0585aaf13f7d25510c55ca06611cb2135af (diff)
if no errLoc, no Loc.
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r--src/libutil/error.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc
index 3a9b924f2..65c5813a4 100644
--- a/src/libutil/error.cc
+++ b/src/libutil/error.cc
@@ -94,8 +94,10 @@ std::optional<LinesOfCode> getCodeLines(const ErrPos &errPos)
}
}
catch (EndOfFile &eof) {
- // TODO: return maybe partial loc?
- return std::nullopt;
+ if (loc.errLineOfCode.has_value())
+ return loc;
+ else
+ return std::nullopt;
}
catch (std::exception &e) {
printError("error reading nix file: %s\n%s", errPos.file, e.what());