summaryrefslogtreecommitdiff
path: root/packages/ptc/src/c_api/error.inc
blob: af05fbb66bc14fed0822e2ca06e85add291c1e94 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Function ptc_error_create(message : String) : TPTC_ERROR;

Begin
  Try
    ptc_error_create := TPTC_ERROR(TPTCError.Create(message));
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_error_create := Nil;
    End;
  End;
End;

Function ptc_error_create_composite(message : String; error : TPTC_ERROR) : TPTC_ERROR;

Begin
  Try
    ptc_error_create_composite := TPTC_ERROR(TPTCError.Create(message, TPTCError(error)));
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_error_create_composite := Nil;
    End;
  End;
End;

Procedure ptc_error_destroy(obj : TPTC_ERROR);

Begin
  If obj = Nil Then
    Exit;
  Try
    TPTCError(obj).Destroy;
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Procedure ptc_error_report(obj : TPTC_ERROR);

Begin
  Try
    TPTCError(obj).report;
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Function ptc_error_message(obj : TPTC_ERROR) : String;

Begin
  Try
    ptc_error_message := TPTCError(obj).message;
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_error_message := '';
    End;
  End;
End;

Procedure ptc_error_assign(obj, error : TPTC_ERROR);

Begin
  Try
    TPTCError(obj).ASSign(TPTCError(error));
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Function ptc_error_equals(obj, error : TPTC_ERROR) : Boolean;

Begin
  Try
    ptc_error_equals := TPTCError(obj).Equals(TPTCError(error));
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_error_equals := False;
    End;
  End;
End;

Procedure ptc_error_handler(handler : TPTC_ERROR_HANDLER);

Begin
  ptc_exception_handler(handler);
End;