aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-04-08 09:48:21 -0600
committerBen Burdette <bburdette@gmail.com>2020-04-08 09:48:21 -0600
commit54f91923c844a98c4f8fd4c06feab9421a879ad7 (patch)
treece60ab31c1656c6f41b4118b08c60548f7cee6f8 /src/libutil/error.hh
parent47ed067d45d3de7786cdb55f187b0db2eb6289c1 (diff)
return of NixCode
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r--src/libutil/error.hh63
1 files changed, 17 insertions, 46 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh
index b687bde81..7e76c0079 100644
--- a/src/libutil/error.hh
+++ b/src/libutil/error.hh
@@ -29,9 +29,24 @@ public:
{
lineNumber = pos.line;
column = pos.column;
- nixFile = pos.file.str();
+ nixFile = pos.file;
return *this;
}
+
+ template <class P>
+ ErrPos(const P &p)
+ {
+ *this = p;
+ }
+};
+
+class NixCode
+{
+public:
+ ErrPos errPos;
+ std::optional<string> prevLineOfCode;
+ string errLineOfCode;
+ std::optional<string> nextLineOfCode;
};
// ----------------------------------------------------------------
@@ -99,55 +114,11 @@ public:
string name;
string description;
std::optional<hintformat> hint;
- std::optional<string> prevLineOfCode;
- string errLineOfCode;
- std::optional<string> nextLineOfCode;
- std::optional<ErrPos> errPos;
+ std::optional<NixCode> nixCode;
static std::optional<string> programName;
private:
- // template <class P>
- // static ErrorInfo NixLangEI(ErrLevel level,
- // const string &name,
- // const string &description,
- // const P &pos,
- // std::optional<string> prevloc,
- // string loc,
- // std::optional<string> nextloc,
- // const std::optional<hintformat> &hf)
- // {
- // ErrorInfo ei(level);
- // ei.name = name;
- // ei.description = description;
- // if (hf.has_value())
- // ei.hint = std::optional<string>(hf->str());
- // else
- // ei.hint = std::nullopt;
-
- // ErrLine errline;
- // errline.lineNumber = pos.line;
- // errline.column = pos.column;
- // errline.prevLineOfCode = prevloc;
- // errline.errLineOfCode = loc;
- // errline.nextLineOfCode = nextloc;
- // NixCode nixcode;
- // nixcode.nixFile = pos.file;
- // nixcode.errLine = std::optional(errline);
- // ei.nixCode = std::optional(nixcode);
-
- // return ei;
- // }
-
- // static ErrorInfo ProgramEI(ErrLevel level,
- // const string &name,
- // const string &description,
- // const std::optional<hintformat> &hf);
-
-
-
- // constructor is protected, so only the builder classes can create an ErrorInfo.
-
};
// --------------------------------------------------------