diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-06-19 13:44:08 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-06-19 13:44:08 -0600 |
commit | 54e8f550c9d5cc88c1161035d366871bb82d4a0c (patch) | |
tree | dbd84d78a0a0d7e2b107561487b6d7e033174687 /src/libutil/error.hh | |
parent | 4d1a4f02178b1f77a4bcf2de0483500d89c1424c (diff) |
addErrorTrace
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r-- | src/libutil/error.hh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 10bdeea1d..75ba80365 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -94,7 +94,7 @@ struct NixCode { }; struct Trace { - ErrPos pos; + std::optional<ErrPos> pos; hintformat hint; }; @@ -116,9 +116,12 @@ std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo); class BaseError : public std::exception { protected: - string prefix_; // used for location traces etc. + // string prefix_; // used for location traces etc. mutable ErrorInfo err; + // mutable std::optional<string> trace_; + // const string& calcTrace() const; + mutable std::optional<string> what_; const string& calcWhat() const; @@ -164,9 +167,9 @@ public: #endif const string & msg() const { return calcWhat(); } - const string & prefix() const { return prefix_; } - BaseError & addPrefix(const FormatOrString & fs); - BaseError & addTrace(ErrPos e, hintformat hint); + // const string & trace() const { return calcTrace(); } + // BaseError & addPrefix(const FormatOrString & fs); + BaseError & addTrace(std::optional<ErrPos> e, hintformat hint); const ErrorInfo & info() { calcWhat(); return err; } }; |