1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11:15 +02:00

addErrorTrace

This commit is contained in:
Ben Burdette 2020-06-19 13:44:08 -06:00
parent 4d1a4f0217
commit 54e8f550c9
8 changed files with 270 additions and 220 deletions

View file

@ -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; }
};