1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00
This commit is contained in:
Ben Burdette 2020-03-24 09:18:23 -06:00
parent aadd59d005
commit 4171ab4bbd
3 changed files with 39 additions and 9 deletions

View file

@ -39,13 +39,40 @@ class NixCode {
class ErrorInfo {
public:
ErrLevel level;
string errName;
string name;
string description;
string toolName;
string program;
optional<NixCode> nixCode;
string hint;
ErrorInfo& GetEI() { return *this; }
};
template <class T>
class AddName : private T
{
public:
T& name(const std::string &name){
GetEI().name = name;
return *this;
}
protected:
ErrorInfo& GetEI() { return T::GetEI(); }
};
template <class T>
class AddDescription : private T
{
public:
T& description(const std::string &description){
GetEI().description = description;
return *this;
}
protected:
ErrorInfo& GetEI() { return T::GetEI(); }
};
typedef AddName<AddDescription<ErrorInfo>> StandardError;
string showErrLine(ErrLine &errLine);
void print_code_lines(string &prefix, NixCode &nix_code);