aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/main.cc
blob: 1c998103e20f0f16a011abaa3920699de0877d00 (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
#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;
  generic.errName = "error name";
  generic.description = "general error description";
  generic.toolName = "nixtool.exe";
  generic.nixCode = nixcode;

  print_error(generic);

  return 0;
}