lix/tests/errors/main.cc

45 lines
792 B
C++
Raw Normal View History

2020-03-23 21:29:49 +00:00
#include "error.hh"
#include <optional>
#include <iostream>
using std::optional;
int main() {
using namespace nix;
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;
2020-03-24 15:18:23 +00:00
generic.name = "error name";
2020-03-23 21:29:49 +00:00
generic.description = "general error description";
2020-03-24 15:18:23 +00:00
generic.program = "nixtool.exe";
2020-03-23 21:29:49 +00:00
generic.nixCode = nixcode;
print_error(generic);
2020-03-24 15:18:23 +00:00
StandardError standardError;
print_error(standardError.name("blah").description("blah"));
2020-03-23 21:29:49 +00:00
return 0;
}