blob: ffce334b73830176733657752addb1985638b95d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#include "error.hh"
#include <optional>
#include <iostream>
using std::optional;
using std::nullopt;
using std::cout;
using std::endl;
int main()
{
using namespace nix;
ErrorInfo::programName = optional("error-test");
/*
ColumnRange columnRange;
columnRange.start = 24;
columnRange.len = 14;
ErrLine errline;
errline.lineNumber = 7;
errline.columnRange = optional(columnRange);
errline.errLineOfCode = "line of code where the error occurred";
NixCode nixcode;
nixcode.nixFile = optional("myfile.nix");
nixcode.errLine = errline;
ErrorInfo generic;
generic.level = elError;
generic.name = "error name";
generic.description = "general error description";
generic.program = "nixtool.exe";
generic.nixCode = nixcode;
printErrorInfo(generic);
*/
printErrorInfo(StandardError()
.name("name")
.description("error description")
.nohint()
);
printErrorInfo(StandardWarning()
.name("warning name")
.description("warning description")
.nohint()
);
printErrorInfo(MkNixWarning()
.name("warning name")
.description("warning description")
.nixFile("myfile.nix")
.lineNumber(40)
.columnRange(13,7)
.linesOfCode(nullopt
,"this is the problem line of code"
,nullopt)
.hint(hintfmt("this hint has %1% templated %2%!!") % "yellow" % "values")
);
printErrorInfo(MkNixError()
.name("error name")
.description("error description")
.nixFile("myfile.nix")
.lineNumber(40)
.columnRange(13,7)
.linesOfCode(optional("previous line of code")
,"this is the problem line of code"
,optional("next line of code"))
.hint(hintfmt("this hint has %1% templated %2%!!") % "yellow" % "values")
);
return 0;
}
|