diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-06-04 11:53:19 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-06-04 11:53:19 -0600 |
commit | 94427ffee3493077206f960e3cda9bbb659583be (patch) | |
tree | 5ab98795998d949621fa7568338a7d20a39dd215 /src/libutil/error.cc | |
parent | 721943e1d44b63d1a4055309fad39e1f4c0f9f0d (diff) |
add some comments
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r-- | src/libutil/error.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 539a7543f..1fcb8111c 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -10,13 +10,16 @@ namespace nix { const std::string nativeSystem = SYSTEM; - +// addPrefix is used for show-trace. Strings added with addPrefix +// will print ahead of the error itself. BaseError & BaseError::addPrefix(const FormatOrString & fs) { prefix_ = fs.s + prefix_; return *this; } +// c++ std::exception descendants must have a 'const char* what()' function. +// This stringifies the error and caches it for use by what(), or similarly by msg(). const string& BaseError::calcWhat() const { if (what_.has_value()) @@ -53,6 +56,7 @@ string showErrPos(const ErrPos &errPos) } } +// if nixCode contains lines of code, print them to the ostream, indicating the error column. void printCodeLines(std::ostream &out, const string &prefix, const NixCode &nixCode) { // previous line of code. |