-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogError.pas
More file actions
72 lines (57 loc) · 1.68 KB
/
LogError.pas
File metadata and controls
72 lines (57 loc) · 1.68 KB
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
unit LogError;
interface
uses SysUtils;
type
Logger = class
private
error_text: String;
file_is_correct : Boolean;
public
constructor Create();
procedure record_error(filename: String; id_column: Integer);
function get_error_text() : String;
function check_is_successful() : Boolean;
end;
implementation
constructor Logger.Create();
begin
error_text := '';
file_is_correct := True;
end;
procedure Logger.record_error(filename: String; id_column: Integer);
var
curr_error: String;
real_id_column : Integer;
begin;
case id_column of
0: curr_error := ': incorrect data in the file ';
1: curr_error := ': incorrect date ';
2: curr_error := ': coefficients have different names ';
3: curr_error := ': incorrect parameter 1 ';
4: curr_error := ': incorrect parameter 2 ';
5: curr_error := ': incorrect type ';
6: curr_error := ': used the old name ';
7, 8, 9: curr_error := ': different values ';
10: curr_error := ': values are not activated ';
11: curr_error := ': incorrect number shop ';
12: curr_error := ': incorrect subsidiary ';
13: curr_error := ': incorrect business_line ';
else curr_error := ': incorrect file structure ';
end;
real_id_column := id_column;
if(id_column = 0) then begin
real_id_column := 2;
end;
error_text := error_text + filename + curr_error + '(see column ' + IntToStr(real_id_column) + ')' + #13#10;
file_is_correct := False;
end;
function Logger.get_error_text() : String;
begin
if file_is_correct then Result := 'OK'
else Result := error_text;
end;
function Logger.check_is_successful() : Boolean;
begin
Result := file_is_correct;
end;
end.